diff --git a/src/alchemy.c b/src/alchemy.c
index 7e055b4a8..40e060425 100644
--- a/src/alchemy.c
+++ b/src/alchemy.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -49,203 +49,212 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 void herbsearch(region * r, unit * u, int max)
 {
-  int herbsfound;
-  const item_type *whichherb;
+    int herbsfound;
+    const item_type *whichherb;
 
-  if (eff_skill(u, SK_HERBALISM, r) == 0) {
-    cmistake(u, u->thisorder, 59, MSG_PRODUCE);
-    return;
-  }
+    if (eff_skill(u, SK_HERBALISM, r) == 0) {
+        cmistake(u, u->thisorder, 59, MSG_PRODUCE);
+        return;
+    }
 
-  if (is_guarded(r, u, GUARD_PRODUCE)) {
-    cmistake(u, u->thisorder, 70, MSG_EVENT);
-    return;
-  }
+    if (is_guarded(r, u, GUARD_PRODUCE)) {
+        cmistake(u, u->thisorder, 70, MSG_EVENT);
+        return;
+    }
 
-  whichherb = rherbtype(r);
-  if (whichherb == NULL) {
-    cmistake(u, u->thisorder, 108, MSG_PRODUCE);
-    return;
-  }
+    whichherb = rherbtype(r);
+    if (whichherb == NULL) {
+        cmistake(u, u->thisorder, 108, MSG_PRODUCE);
+        return;
+    }
 
-  if (max)
-    max = _min(max, rherbs(r));
-  else
-    max = rherbs(r);
-  herbsfound = ntimespprob(eff_skill(u, SK_HERBALISM, r) * u->number,
-    (double)rherbs(r) / 100.0F, -0.01F);
-  herbsfound = _min(herbsfound, max);
-  rsetherbs(r, rherbs(r) - herbsfound);
+    if (max)
+        max = _min(max, rherbs(r));
+    else
+        max = rherbs(r);
+    herbsfound = ntimespprob(eff_skill(u, SK_HERBALISM, r) * u->number,
+        (double)rherbs(r) / 100.0F, -0.01F);
+    herbsfound = _min(herbsfound, max);
+    rsetherbs(r, rherbs(r) - herbsfound);
 
-  if (herbsfound) {
-    produceexp(u, SK_HERBALISM, u->number);
-    i_change(&u->items, whichherb, herbsfound);
-    ADDMSG(&u->faction->msgs, msg_message("herbfound",
-        "unit region amount herb", u, r, herbsfound, whichherb->rtype));
-  } else {
-    ADDMSG(&u->faction->msgs, msg_message("researchherb_none",
-        "unit region", u, u->region));
-  }
+    if (herbsfound) {
+        produceexp(u, SK_HERBALISM, u->number);
+        i_change(&u->items, whichherb, herbsfound);
+        ADDMSG(&u->faction->msgs, msg_message("herbfound",
+            "unit region amount herb", u, r, herbsfound, whichherb->rtype));
+    }
+    else {
+        ADDMSG(&u->faction->msgs, msg_message("researchherb_none",
+            "unit region", u, u->region));
+    }
 }
 
 static int begin_potion(unit * u, const potion_type * ptype, struct order *ord)
 {
-  static int rule_multipotion = -1;
-  assert(ptype != NULL);
+    static int rule_multipotion = -1;
+    assert(ptype != NULL);
 
-  if (rule_multipotion < 0) {
-    /* should we allow multiple different potions to be used the same turn? */
-    rule_multipotion =
-      get_param_int(global.parameters, "rules.magic.multipotion", 0);
-  }
-  if (!rule_multipotion) {
-    const potion_type *use = ugetpotionuse(u);
-    if (use != NULL && use != ptype) {
-      ADDMSG(&u->faction->msgs,
-        msg_message("errusingpotion", "unit using command",
-          u, use->itype->rtype, ord));
-      return ECUSTOM;
+    if (rule_multipotion < 0) {
+        /* should we allow multiple different potions to be used the same turn? */
+        rule_multipotion =
+            get_param_int(global.parameters, "rules.magic.multipotion", 0);
     }
-  }
-  return 0;
+    if (!rule_multipotion) {
+        const potion_type *use = ugetpotionuse(u);
+        if (use != NULL && use != ptype) {
+            ADDMSG(&u->faction->msgs,
+                msg_message("errusingpotion", "unit using command",
+                u, use->itype->rtype, ord));
+            return ECUSTOM;
+        }
+    }
+    return 0;
 }
 
 static void end_potion(unit * u, const potion_type * ptype, int amount)
 {
-  use_pooled(u, ptype->itype->rtype, GET_SLACK | GET_RESERVE | GET_POOLED_SLACK,
-    amount);
-  usetpotionuse(u, ptype);
+    use_pooled(u, ptype->itype->rtype, GET_SLACK | GET_RESERVE | GET_POOLED_SLACK,
+        amount);
+    usetpotionuse(u, ptype);
 
-  ADDMSG(&u->faction->msgs, msg_message("usepotion",
-      "unit potion", u, ptype->itype->rtype));
+    ADDMSG(&u->faction->msgs, msg_message("usepotion",
+        "unit potion", u, ptype->itype->rtype));
 }
 
 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);
+    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));
     }
-    /* 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);
+    else if (ptype == oldpotiontype[P_HEILWASSER]) {
+        u->hp = _min(unit_max_hp(u) * u->number, u->hp + 400 * 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;
+    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;
     }
-    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;
+    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;
 }
 
 int use_potion(unit * u, const item_type * itype, int amount, struct order *ord)
 {
-  const potion_type *ptype = resource2potion(itype->rtype);
+    const potion_type *ptype = resource2potion(itype->rtype);
 
-  if (oldpotiontype[P_HEAL] && ptype == oldpotiontype[P_HEAL]) {
-    return EUNUSABLE;
-  } else {
-    int result = begin_potion(u, ptype, ord);
-    if (result)
-      return result;
-    amount = do_potion(u, u->region, ptype, amount);
-    end_potion(u, ptype, amount);
-  }
-  return 0;
+    if (oldpotiontype[P_HEAL] && ptype == oldpotiontype[P_HEAL]) {
+        return EUNUSABLE;
+    }
+    else {
+        int result = begin_potion(u, ptype, ord);
+        if (result)
+            return result;
+        amount = do_potion(u, u->region, ptype, amount);
+        end_potion(u, ptype, amount);
+    }
+    return 0;
 }
 
 typedef struct potiondelay {
-  unit *u;
-  region *r;
-  const potion_type *ptype;
-  int amount;
+    unit *u;
+    region *r;
+    const potion_type *ptype;
+    int amount;
 } potiondelay;
 
 static void init_potiondelay(attrib * a)
 {
-  a->data.v = malloc(sizeof(potiondelay));
+    a->data.v = malloc(sizeof(potiondelay));
 }
 
 static void free_potiondelay(attrib * a)
 {
-  free(a->data.v);
+    free(a->data.v);
 }
 
 static int age_potiondelay(attrib * a)
 {
-  potiondelay *pd = (potiondelay *) a->data.v;
-  pd->amount = do_potion(pd->u, pd->r, pd->ptype, pd->amount);
-  return AT_AGE_REMOVE;
+    potiondelay *pd = (potiondelay *)a->data.v;
+    pd->amount = do_potion(pd->u, pd->r, pd->ptype, pd->amount);
+    return AT_AGE_REMOVE;
 }
 
 attrib_type at_potiondelay = {
-  "potiondelay",
-  init_potiondelay,
-  free_potiondelay,
-  age_potiondelay, 0, 0
+    "potiondelay",
+    init_potiondelay,
+    free_potiondelay,
+    age_potiondelay, 0, 0
 };
 
 static attrib *make_potiondelay(unit * u, const potion_type * ptype, int amount)
 {
-  attrib *a = a_new(&at_potiondelay);
-  potiondelay *pd = (potiondelay *) a->data.v;
-  pd->u = u;
-  pd->r = u->region;
-  pd->ptype = ptype;
-  pd->amount = amount;
-  return a;
+    attrib *a = a_new(&at_potiondelay);
+    potiondelay *pd = (potiondelay *)a->data.v;
+    pd->u = u;
+    pd->r = u->region;
+    pd->ptype = ptype;
+    pd->amount = amount;
+    return a;
 }
 
 int
 use_potion_delayed(unit * u, const item_type * itype, int amount,
-  struct order *ord)
+struct order *ord)
 {
-  const potion_type *ptype = resource2potion(itype->rtype);
-  int result = begin_potion(u, ptype, ord);
-  if (result)
-    return result;
+    const potion_type *ptype = resource2potion(itype->rtype);
+    int result = begin_potion(u, ptype, ord);
+    if (result)
+        return result;
 
-  a_add(&u->attribs, make_potiondelay(u, ptype, amount));
+    a_add(&u->attribs, make_potiondelay(u, ptype, amount));
 
-  end_potion(u, ptype, amount);
-  return 0;
+    end_potion(u, ptype, amount);
+    return 0;
 }
 
 /*****************/
@@ -254,88 +263,89 @@ use_potion_delayed(unit * u, const item_type * itype, int amount,
 
 static void a_initeffect(attrib * a)
 {
-  a->data.v = calloc(sizeof(effect_data), 1);
+    a->data.v = calloc(sizeof(effect_data), 1);
 }
 
 static void a_finalizeeffect(attrib * a)
 {
-  free(a->data.v);
+    free(a->data.v);
 }
 
 static void
 a_writeeffect(const attrib * a, const void *owner, struct storage *store)
 {
-  effect_data *edata = (effect_data *) a->data.v;
-  WRITE_TOK(store, resourcename(edata->type->itype->rtype, 0));
-  WRITE_INT(store, edata->value);
+    effect_data *edata = (effect_data *)a->data.v;
+    WRITE_TOK(store, resourcename(edata->type->itype->rtype, 0));
+    WRITE_INT(store, edata->value);
 }
 
 static int a_readeffect(attrib * a, void *owner, struct storage *store)
 {
-  int power;
-  const resource_type *rtype;
-  effect_data *edata = (effect_data *) a->data.v;
-  char zText[32];
+    int power;
+    const resource_type *rtype;
+    effect_data *edata = (effect_data *)a->data.v;
+    char zText[32];
 
-  READ_TOK(store, zText, sizeof(zText));
-  rtype = rt_find(zText);
+    READ_TOK(store, zText, sizeof(zText));
+    rtype = rt_find(zText);
 
-  READ_INT(store, &power);
-  if (rtype == NULL || rtype->ptype == NULL || power <= 0) {
-    return AT_READ_FAIL;
-  }
-  edata->type = rtype->ptype;
-  edata->value = power;
-  return AT_READ_OK;
+    READ_INT(store, &power);
+    if (rtype == NULL || rtype->ptype == NULL || power <= 0) {
+        return AT_READ_FAIL;
+    }
+    edata->type = rtype->ptype;
+    edata->value = power;
+    return AT_READ_OK;
 }
 
 attrib_type at_effect = {
-  "effect",
-  a_initeffect,
-  a_finalizeeffect,
-  DEFAULT_AGE,
-  a_writeeffect,
-  a_readeffect,
+    "effect",
+    a_initeffect,
+    a_finalizeeffect,
+    DEFAULT_AGE,
+    a_writeeffect,
+    a_readeffect,
 };
 
 int get_effect(const unit * u, const potion_type * effect)
 {
-  const attrib *a;
-  for (a = a_find(u->attribs, &at_effect); a != NULL && a->type == &at_effect;
-    a = a->next) {
-    const effect_data *data = (const effect_data *)a->data.v;
-    if (data->type == effect)
-      return data->value;
-  }
-  return 0;
+    const attrib *a;
+    for (a = a_find(u->attribs, &at_effect); a != NULL && a->type == &at_effect;
+        a = a->next) {
+        const effect_data *data = (const effect_data *)a->data.v;
+        if (data->type == effect)
+            return data->value;
+    }
+    return 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;
+    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;
+        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->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;
+        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;
 }
diff --git a/src/alchemy.h b/src/alchemy.h
index 46feeb689..98347bfb9 100644
--- a/src/alchemy.h
+++ b/src/alchemy.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -28,52 +28,52 @@ extern "C" {
     struct region;
     struct item_type;
     struct order;
-    
-  enum {
-    /* Stufe 1 */
-    P_FAST,
-    P_STRONG,
-    P_LIFE,
-    /* Stufe 2 */
-    P_DOMORE,
-    P_HEILWASSER,
-    P_BAUERNBLUT,
-    /* Stufe 3 */
-    P_WISE,                     /* 6 */
-    P_FOOL,
+
+    enum {
+        /* Stufe 1 */
+        P_FAST,
+        P_STRONG,
+        P_LIFE,
+        /* Stufe 2 */
+        P_DOMORE,
+        P_HEILWASSER,
+        P_BAUERNBLUT,
+        /* Stufe 3 */
+        P_WISE,                     /* 6 */
+        P_FOOL,
 #ifdef INSECT_POTION
-    P_WARMTH,
+        P_WARMTH,
 #else
-    P_STEEL,
+        P_STEEL,
 #endif
-    P_HORSE,
-    P_BERSERK,                  /* 10 */
-    /* Stufe 4 */
-    P_PEOPLE,
-    P_WAHRHEIT,
-    P_MACHT,
-    P_HEAL,
-    MAX_POTIONS
-  };
+        P_HORSE,
+        P_BERSERK,                  /* 10 */
+        /* Stufe 4 */
+        P_PEOPLE,
+        P_WAHRHEIT,
+        P_MACHT,
+        P_HEAL,
+        MAX_POTIONS
+    };
 
-  extern void herbsearch(struct region *r, struct unit *u, int max);
-  extern int use_potion(struct unit *u, const struct item_type *itype,
-    int amount, struct order *);
-  extern int use_potion_delayed(struct unit *u, const struct item_type *itype,
-    int amount, struct order *);
-  extern void init_potions(void);
+    extern void herbsearch(struct region *r, struct unit *u, int max);
+    extern int use_potion(struct unit *u, const struct item_type *itype,
+        int amount, struct order *);
+    extern int use_potion_delayed(struct unit *u, const struct item_type *itype,
+        int amount, struct order *);
+    extern void init_potions(void);
 
 
-  extern int get_effect(const struct unit *u, const struct potion_type *effect);
-  extern int change_effect(struct unit *u, const struct potion_type *effect,
-    int value);
-  extern struct attrib_type at_effect;
+    extern int get_effect(const struct unit *u, const struct potion_type *effect);
+    extern int change_effect(struct unit *u, const struct potion_type *effect,
+        int value);
+    extern struct attrib_type at_effect;
 
-/* rausnehmen, sobald man attribute splitten kann: */
-  typedef struct effect_data {
-    const struct potion_type *type;
-    int value;
-  } effect_data;
+    /* rausnehmen, sobald man attribute splitten kann: */
+    typedef struct effect_data {
+        const struct potion_type *type;
+        int value;
+    } effect_data;
 
 #ifdef __cplusplus
 }
diff --git a/src/attributes/attributes.c b/src/attributes/attributes.c
index f15077a98..1440d4bed 100644
--- a/src/attributes/attributes.c
+++ b/src/attributes/attributes.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/attributes/attributes.h b/src/attributes/attributes.h
index 284c43f88..0b116fb3f 100644
--- a/src/attributes/attributes.h
+++ b/src/attributes/attributes.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,7 +22,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  extern void register_attributes(void);
+    extern void register_attributes(void);
 
 #ifdef __cplusplus
 }
diff --git a/src/attributes/dict.c b/src/attributes/dict.c
index 7efcc41c5..6f72f28b2 100644
--- a/src/attributes/dict.c
+++ b/src/attributes/dict.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/attributes/dict.h b/src/attributes/dict.h
index 2f6bf14c3..5b282779e 100644
--- a/src/attributes/dict.h
+++ b/src/attributes/dict.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -26,12 +26,12 @@ extern "C" {
 
     extern struct attrib_type at_dict;
 
-    extern struct attrib *dict_create(const char *name, dict_type type,
+    struct attrib *dict_create(const char *name, dict_type type,
         variant value);
-    extern void dict_get(const struct attrib *a, dict_type * type,
+    void dict_get(const struct attrib *a, dict_type * type,
         variant * value);
-    extern void dict_set(struct attrib *a, dict_type type, variant value);
-    extern const char *dict_name(const struct attrib *a);
+    void dict_set(struct attrib *a, dict_type type, variant value);
+    const char *dict_name(const struct attrib *a);
 
 #ifdef __cplusplus
 }
diff --git a/src/attributes/fleechance.c b/src/attributes/fleechance.c
index a33237c58..4fe3a32ad 100644
--- a/src/attributes/fleechance.c
+++ b/src/attributes/fleechance.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,22 +22,22 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include <util/attrib.h>
 
 attrib_type at_fleechance = {
-  "fleechance",
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  NULL,
+    "fleechance",
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
 };
 
 attrib *make_fleechance(float fleechance)
 {
-  attrib *a = a_new(&at_fleechance);
-  a->data.flt = fleechance;
-  return a;
+    attrib *a = a_new(&at_fleechance);
+    a->data.flt = fleechance;
+    return a;
 }
 
 void init_fleechance(void)
 {
-  at_register(&at_fleechance);
+    at_register(&at_fleechance);
 }
diff --git a/src/attributes/fleechance.h b/src/attributes/fleechance.h
index 98f5811ff..6ffe7305e 100644
--- a/src/attributes/fleechance.h
+++ b/src/attributes/fleechance.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,10 +22,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  extern struct attrib_type at_fleechance;
+    extern struct attrib_type at_fleechance;
 
-  extern struct attrib *make_fleechance(float fleechance);
-  extern void init_fleechance(void);
+    struct attrib *make_fleechance(float fleechance);
+    void init_fleechance(void);
 
 #ifdef __cplusplus
 }
diff --git a/src/attributes/follow.c b/src/attributes/follow.c
index 16d8dcff0..67c9241e4 100644
--- a/src/attributes/follow.c
+++ b/src/attributes/follow.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -29,17 +29,17 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 static int read_follow(attrib * a, void *owner, struct storage *store)
 {
-  read_unit_reference(store);   /* skip it */
-  return AT_READ_FAIL;
+    read_unit_reference(store);   /* skip it */
+    return AT_READ_FAIL;
 }
 
 attrib_type at_follow = {
-  "follow", NULL, NULL, NULL, NULL, read_follow
+    "follow", NULL, NULL, NULL, NULL, read_follow
 };
 
 attrib *make_follow(struct unit * u)
 {
-  attrib *a = a_new(&at_follow);
-  a->data.v = u;
-  return a;
+    attrib *a = a_new(&at_follow);
+    a->data.v = u;
+    return a;
 }
diff --git a/src/attributes/follow.h b/src/attributes/follow.h
index 3604971c3..257a4ede8 100644
--- a/src/attributes/follow.h
+++ b/src/attributes/follow.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,11 +22,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  extern struct attrib_type at_follow;
+    extern struct attrib_type at_follow;
 
-  struct unit;
+    struct unit;
 
-  extern struct attrib *make_follow(struct unit *u);
+    struct attrib *make_follow(struct unit *u);
 
 #ifdef __cplusplus
 }
diff --git a/src/attributes/hate.c b/src/attributes/hate.c
index b3a80f1bc..d748808f6 100644
--- a/src/attributes/hate.c
+++ b/src/attributes/hate.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -30,40 +30,40 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 static int verify_hate(attrib * a)
 {
-  if (a->data.v == NULL) {
-    return 0;
-  }
-  return 1;
+    if (a->data.v == NULL) {
+        return 0;
+    }
+    return 1;
 }
 
 static void
 write_hate(const attrib * a, const void *owner, struct storage *store)
 {
-  write_unit_reference((unit *) a->data.v, store);
+    write_unit_reference((unit *)a->data.v, store);
 }
 
 static int read_hate(attrib * a, void *owner, struct storage *store)
 {
-  int result =
-    read_reference(&a->data.v, store, read_unit_reference, resolve_unit);
-  if (result == 0 && !a->data.v) {
-    return AT_READ_FAIL;
-  }
-  return AT_READ_OK;
+    int result =
+        read_reference(&a->data.v, store, read_unit_reference, resolve_unit);
+    if (result == 0 && !a->data.v) {
+        return AT_READ_FAIL;
+    }
+    return AT_READ_OK;
 }
 
 attrib_type at_hate = {
-  "hates",
-  NULL,
-  NULL,
-  verify_hate,
-  write_hate,
-  read_hate,
+    "hates",
+    NULL,
+    NULL,
+    verify_hate,
+    write_hate,
+    read_hate,
 };
 
 attrib *make_hate(struct unit * u)
 {
-  attrib *a = a_new(&at_hate);
-  a->data.v = u;
-  return a;
+    attrib *a = a_new(&at_hate);
+    a->data.v = u;
+    return a;
 }
diff --git a/src/attributes/hate.h b/src/attributes/hate.h
index 14b4a5189..09503a890 100644
--- a/src/attributes/hate.h
+++ b/src/attributes/hate.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,11 +22,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  extern struct attrib_type at_hate;
+    extern struct attrib_type at_hate;
 
-  struct unit;
+    struct unit;
 
-  extern struct attrib *make_hate(struct unit *u);
+    extern struct attrib *make_hate(struct unit *u);
 
 #ifdef __cplusplus
 }
diff --git a/src/attributes/iceberg.c b/src/attributes/iceberg.c
index 8a36d1f56..cc7986d79 100644
--- a/src/attributes/iceberg.c
+++ b/src/attributes/iceberg.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -24,18 +24,18 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include <util/attrib.h>
 
 attrib_type at_iceberg = {
-  "iceberg_drift",
-  NULL,
-  NULL,
-  NULL,
-  a_writeint,
-  a_readint,
-  ATF_UNIQUE
+    "iceberg_drift",
+    NULL,
+    NULL,
+    NULL,
+    a_writeint,
+    a_readint,
+    ATF_UNIQUE
 };
 
 attrib *make_iceberg(direction_t dir)
 {
-  attrib *a = a_new(&at_iceberg);
-  a->data.i = (int)dir;
-  return a;
+    attrib *a = a_new(&at_iceberg);
+    a->data.i = (int)dir;
+    return a;
 }
diff --git a/src/attributes/iceberg.h b/src/attributes/iceberg.h
index 4702f5620..3b927b2cd 100644
--- a/src/attributes/iceberg.h
+++ b/src/attributes/iceberg.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -25,9 +25,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  extern struct attrib_type at_iceberg;
+    extern struct attrib_type at_iceberg;
 
-  extern struct attrib *make_iceberg(direction_t dir);
+    struct attrib *make_iceberg(direction_t dir);
 
 #ifdef __cplusplus
 }
diff --git a/src/attributes/key.c b/src/attributes/key.c
index 19a7bcd44..56ec54f34 100644
--- a/src/attributes/key.c
+++ b/src/attributes/key.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -24,34 +24,34 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include <util/attrib.h>
 
 attrib_type at_key = {
-  "key",
-  NULL,
-  NULL,
-  NULL,
-  a_writeint,
-  a_readint,
+    "key",
+    NULL,
+    NULL,
+    NULL,
+    a_writeint,
+    a_readint,
 };
 
 attrib *add_key(attrib ** alist, int key)
 {
-  attrib *a = find_key(*alist, key);
-  if (a == NULL)
-    a = a_add(alist, make_key(key));
-  return a;
+    attrib *a = find_key(*alist, key);
+    if (a == NULL)
+        a = a_add(alist, make_key(key));
+    return a;
 }
 
 attrib *make_key(int key)
 {
-  attrib *a = a_new(&at_key);
-  a->data.i = key;
-  return a;
+    attrib *a = a_new(&at_key);
+    a->data.i = key;
+    return a;
 }
 
 attrib *find_key(attrib * alist, int key)
 {
-  attrib *a = a_find(alist, &at_key);
-  while (a && a->type == &at_key && a->data.i != key) {
-    a = a->next;
-  }
-  return (a && a->type == &at_key) ? a : NULL;
+    attrib *a = a_find(alist, &at_key);
+    while (a && a->type == &at_key && a->data.i != key) {
+        a = a->next;
+    }
+    return (a && a->type == &at_key) ? a : NULL;
 }
diff --git a/src/attributes/key.h b/src/attributes/key.h
index 2aa9fee99..e65883762 100644
--- a/src/attributes/key.h
+++ b/src/attributes/key.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,11 +22,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  extern struct attrib_type at_key;
+    extern struct attrib_type at_key;
 
-  extern struct attrib *make_key(int key);
-  extern struct attrib *find_key(struct attrib *alist, int key);
-  extern struct attrib *add_key(struct attrib **alist, int key);
+    struct attrib *make_key(int key);
+    struct attrib *find_key(struct attrib *alist, int key);
+    struct attrib *add_key(struct attrib **alist, int key);
 
 #ifdef __cplusplus
 }
diff --git a/src/attributes/matmod.c b/src/attributes/matmod.c
index fe38ac20a..52b865374 100644
--- a/src/attributes/matmod.c
+++ b/src/attributes/matmod.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,18 +22,18 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include <util/attrib.h>
 
 attrib_type at_matmod = {
-  "matmod",
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  ATF_PRESERVE
+    "matmod",
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    ATF_PRESERVE
 };
 
 attrib *make_matmod(mm_fun function)
 {
-  attrib *a = a_new(&at_matmod);
-  a->data.f = (void (*)(void))function;
-  return a;
+    attrib *a = a_new(&at_matmod);
+    a->data.f = (void(*)(void))function;
+    return a;
 }
diff --git a/src/attributes/matmod.h b/src/attributes/matmod.h
index fc4570c0f..304f21bc7 100644
--- a/src/attributes/matmod.h
+++ b/src/attributes/matmod.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -23,13 +23,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  struct resource_type;
-  struct unit;
-  typedef int (*mm_fun) (const struct unit * u,
-    const struct resource_type * rtype, int value);
+    struct resource_type;
+    struct unit;
+    typedef int(*mm_fun) (const struct unit * u,
+        const struct resource_type * rtype, int value);
 
-  extern struct attrib_type at_matmod;
-  extern struct attrib *make_matmod(mm_fun function);
+    extern struct attrib_type at_matmod;
+    extern struct attrib *make_matmod(mm_fun function);
 
 #ifdef __cplusplus
 }
diff --git a/src/attributes/moved.c b/src/attributes/moved.c
index 995a190cd..87cac68b3 100644
--- a/src/attributes/moved.c
+++ b/src/attributes/moved.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -26,38 +26,38 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 static int age_moved(attrib * a)
 {
-  --a->data.i;
-  return a->data.i > 0;
+    --a->data.i;
+    return a->data.i > 0;
 }
 
 static void
 write_moved(const attrib * a, const void *owner, struct storage *store)
 {
-  WRITE_INT(store, a->data.i);
+    WRITE_INT(store, a->data.i);
 }
 
 static int read_moved(attrib * a, void *owner, struct storage *store)
 {
-  READ_INT(store, &a->data.i);
-  if (a->data.i != 0)
-    return AT_READ_OK;
-  else
-    return AT_READ_FAIL;
+    READ_INT(store, &a->data.i);
+    if (a->data.i != 0)
+        return AT_READ_OK;
+    else
+        return AT_READ_FAIL;
 }
 
 attrib_type at_moved = {
-  "moved", NULL, NULL, age_moved, write_moved, read_moved
+    "moved", NULL, NULL, age_moved, write_moved, read_moved
 };
 
 bool get_moved(attrib ** alist)
 {
-  return a_find(*alist, &at_moved) ? true : false;
+    return a_find(*alist, &at_moved) ? true : false;
 }
 
 void set_moved(attrib ** alist)
 {
-  attrib *a = a_find(*alist, &at_moved);
-  if (a == NULL)
-    a = a_add(alist, a_new(&at_moved));
-  a->data.i = 2;
+    attrib *a = a_find(*alist, &at_moved);
+    if (a == NULL)
+        a = a_add(alist, a_new(&at_moved));
+    a->data.i = 2;
 }
diff --git a/src/attributes/moved.h b/src/attributes/moved.h
index bad4dcdd5..25a1bc540 100644
--- a/src/attributes/moved.h
+++ b/src/attributes/moved.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,13 +22,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  struct attrib;
-  struct attrib_type;
+    struct attrib;
+    struct attrib_type;
 
-  extern bool get_moved(struct attrib **alist);
-  extern void set_moved(struct attrib **alist);
+    extern bool get_moved(struct attrib **alist);
+    extern void set_moved(struct attrib **alist);
 
-  extern struct attrib_type at_moved;
+    extern struct attrib_type at_moved;
 
 #ifdef __cplusplus
 }
diff --git a/src/attributes/movement.c b/src/attributes/movement.c
index ff206ecfd..b6f6dc9c7 100644
--- a/src/attributes/movement.c
+++ b/src/attributes/movement.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -28,38 +28,38 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 static void
 write_movement(const attrib * a, const void *owner, struct storage *store)
 {
-  WRITE_INT(store, a->data.i);
+    WRITE_INT(store, a->data.i);
 }
 
 static int read_movement(attrib * a, void *owner, struct storage *store)
 {
-  READ_INT(store, &a->data.i);
-  if (a->data.i != 0)
-    return AT_READ_OK;
-  else
-    return AT_READ_FAIL;
+    READ_INT(store, &a->data.i);
+    if (a->data.i != 0)
+        return AT_READ_OK;
+    else
+        return AT_READ_FAIL;
 }
 
 attrib_type at_movement = {
-  "movement", NULL, NULL, NULL, write_movement, read_movement
+    "movement", NULL, NULL, NULL, write_movement, read_movement
 };
 
 bool get_movement(attrib * const *alist, int type)
 {
-  const attrib *a = a_findc(*alist, &at_movement);
-  if (a == NULL)
+    const attrib *a = a_findc(*alist, &at_movement);
+    if (a == NULL)
+        return false;
+    if (a->data.i & type)
+        return true;
     return false;
-  if (a->data.i & type)
-    return true;
-  return false;
 }
 
 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;
+    attrib *a = a_find(*alist, &at_movement);
+    if (a == NULL)
+        a = a_add(alist, a_new(&at_movement));
+    a->data.i |= type;
 }
 
 static int age_speedup(attrib * a)
diff --git a/src/attributes/movement.h b/src/attributes/movement.h
index 86fe32b02..c7a7f2281 100644
--- a/src/attributes/movement.h
+++ b/src/attributes/movement.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,12 +22,12 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  bool get_movement(struct attrib *const *alist, int type);
-  void set_movement(struct attrib **alist, int type);
+    bool get_movement(struct attrib *const *alist, int type);
+    void set_movement(struct attrib **alist, int type);
+
+    extern struct attrib_type at_movement;
+    extern struct attrib_type at_speedup;
 
-  extern struct attrib_type at_movement;
-  extern struct attrib_type at_speedup;
-  
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/attributes/orcification.c b/src/attributes/orcification.c
index 5aa6b8717..b29553cb4 100644
--- a/src/attributes/orcification.c
+++ b/src/attributes/orcification.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -24,16 +24,16 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include <util/attrib.h>
 
 /*
- * simple attributes that do not yet have their own file 
+ * simple attributes that do not yet have their own file
  */
 
 attrib_type at_orcification = {
-  "orcification", NULL, NULL, NULL, a_writeint, a_readint, ATF_UNIQUE
+    "orcification", NULL, NULL, NULL, a_writeint, a_readint, ATF_UNIQUE
 };
 
 attrib *make_orcification(int orcification)
 {
-  attrib *a = a_new(&at_orcification);
-  a->data.i = orcification;
-  return a;
+    attrib *a = a_new(&at_orcification);
+    a->data.i = orcification;
+    return a;
 }
diff --git a/src/attributes/orcification.h b/src/attributes/orcification.h
index cbd21a8ec..884fc2110 100644
--- a/src/attributes/orcification.h
+++ b/src/attributes/orcification.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -19,9 +19,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #ifdef __cplusplus
 extern "C" {
 #endif
-  extern struct attrib_type at_orcification;
+    extern struct attrib_type at_orcification;
 
-  extern struct attrib *make_orcification(int orcification);
+    extern struct attrib *make_orcification(int orcification);
 
 #ifdef __cplusplus
 }
diff --git a/src/attributes/otherfaction.c b/src/attributes/otherfaction.c
index 768e57c9f..222d85c00 100644
--- a/src/attributes/otherfaction.c
+++ b/src/attributes/otherfaction.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -28,58 +28,58 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include <assert.h>
 
 /*
- * simple attributes that do not yet have their own file 
+ * simple attributes that do not yet have their own file
  */
 
 void write_of(const struct attrib *a, const void *owner, struct storage *store)
 {
-  const faction *f = (faction *) a->data.v;
-  WRITE_INT(store, f->no);
+    const faction *f = (faction *)a->data.v;
+    WRITE_INT(store, f->no);
 }
 
 int read_of(struct attrib *a, void *owner, struct storage *store)
 {                               /* return 1 on success, 0 if attrib needs removal */
-  int of;
-  static int rule = -1;
-  if (rule<0) {
-    rule = rule_stealth_faction();
-  }
-
-  READ_INT(store, &of);
-  if (rule&2) {
-    a->data.v = findfaction(of);
-    if (a->data.v) {
-      return AT_READ_OK;
+    int of;
+    static int rule = -1;
+    if (rule < 0) {
+        rule = rule_stealth_faction();
     }
-  }
-  return AT_READ_FAIL;
+
+    READ_INT(store, &of);
+    if (rule & 2) {
+        a->data.v = findfaction(of);
+        if (a->data.v) {
+            return AT_READ_OK;
+        }
+    }
+    return AT_READ_FAIL;
 }
 
 attrib_type at_otherfaction = {
-  "otherfaction", NULL, NULL, NULL, write_of, read_of, ATF_UNIQUE
+    "otherfaction", NULL, NULL, NULL, write_of, read_of, ATF_UNIQUE
 };
 
 struct faction *get_otherfaction(const struct attrib *a)
 {
-  return (faction *) (a->data.v);
+    return (faction *)(a->data.v);
 }
 
 struct attrib *make_otherfaction(struct faction *f)
 {
-  attrib *a = a_new(&at_otherfaction);
-  a->data.v = (void *)f;
-  return a;
+    attrib *a = a_new(&at_otherfaction);
+    a->data.v = (void *)f;
+    return a;
 }
 
 faction *visible_faction(const faction * f, const unit * u)
 {
-  if (f == NULL || !alliedunit(u, f, HELP_FSTEALTH)) {
-    attrib *a = a_find(u->attribs, &at_otherfaction);
-    if (a) {
-      faction *fv = get_otherfaction(a);
-      assert(fv != NULL);       /* fv should never be NULL! */
-      return fv;
+    if (f == NULL || !alliedunit(u, f, HELP_FSTEALTH)) {
+        attrib *a = a_find(u->attribs, &at_otherfaction);
+        if (a) {
+            faction *fv = get_otherfaction(a);
+            assert(fv != NULL);       /* fv should never be NULL! */
+            return fv;
+        }
     }
-  }
-  return u->faction;
+    return u->faction;
 }
diff --git a/src/attributes/otherfaction.h b/src/attributes/otherfaction.h
index 4bb2608d0..e38184988 100644
--- a/src/attributes/otherfaction.h
+++ b/src/attributes/otherfaction.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -20,14 +20,14 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  struct faction;
-  struct attrib;
-  extern struct attrib_type at_otherfaction;
+    struct faction;
+    struct attrib;
+    extern struct attrib_type at_otherfaction;
 
-  extern struct faction *get_otherfaction(const struct attrib *a);
-  extern struct attrib *make_otherfaction(struct faction *f);
-  extern struct faction *visible_faction(const struct faction *f,
-    const struct unit *u);
+    extern struct faction *get_otherfaction(const struct attrib *a);
+    extern struct attrib *make_otherfaction(struct faction *f);
+    extern struct faction *visible_faction(const struct faction *f,
+        const struct unit *u);
 
 #ifdef __cplusplus
 }
diff --git a/src/attributes/overrideroads.c b/src/attributes/overrideroads.c
index 9476b609f..99f4cc517 100644
--- a/src/attributes/overrideroads.c
+++ b/src/attributes/overrideroads.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -24,5 +24,5 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include <util/attrib.h>
 
 attrib_type at_overrideroads = {
-  "roads_override", NULL, NULL, NULL, &a_writestring, &a_readstring
+    "roads_override", NULL, NULL, NULL, &a_writestring, &a_readstring
 };
diff --git a/src/attributes/overrideroads.h b/src/attributes/overrideroads.h
index 9fcfc6610..50d781eb4 100644
--- a/src/attributes/overrideroads.h
+++ b/src/attributes/overrideroads.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,7 +22,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  extern struct attrib_type at_overrideroads;
+    extern struct attrib_type at_overrideroads;
 
 #ifdef __cplusplus
 }
diff --git a/src/attributes/racename.c b/src/attributes/racename.c
index f0255ecb7..13d6019e0 100644
--- a/src/attributes/racename.c
+++ b/src/attributes/racename.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -28,29 +28,31 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include <string.h>
 
 attrib_type at_racename = {
-  "racename", NULL, a_finalizestring, NULL, a_writestring, a_readstring
+    "racename", NULL, a_finalizestring, NULL, a_writestring, a_readstring
 };
 
 const char *get_racename(attrib * alist)
 {
-  attrib *a = a_find(alist, &at_racename);
-  if (a)
-    return (const char *)a->data.v;
-  return NULL;
+    attrib *a = a_find(alist, &at_racename);
+    if (a)
+        return (const char *)a->data.v;
+    return NULL;
 }
 
 void set_racename(attrib ** palist, const char *name)
 {
-  attrib *a = a_find(*palist, &at_racename);
-  if (!a && name) {
-    a = a_add(palist, a_new(&at_racename));
-    a->data.v = _strdup(name);
-  } else if (a && !name) {
-    a_remove(palist, a);
-  } else if (a) {
-    if (strcmp(a->data.v, name) != 0) {
-      free(a->data.v);
-      a->data.v = _strdup(name);
+    attrib *a = a_find(*palist, &at_racename);
+    if (!a && name) {
+        a = a_add(palist, a_new(&at_racename));
+        a->data.v = _strdup(name);
+    }
+    else if (a && !name) {
+        a_remove(palist, a);
+    }
+    else if (a) {
+        if (strcmp(a->data.v, name) != 0) {
+            free(a->data.v);
+            a->data.v = _strdup(name);
+        }
     }
-  }
 }
diff --git a/src/attributes/racename.h b/src/attributes/racename.h
index f4327b20c..545d4b248 100644
--- a/src/attributes/racename.h
+++ b/src/attributes/racename.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,13 +22,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  struct attrib_type;
-  struct attrib;
+    struct attrib_type;
+    struct attrib;
 
-  extern void set_racename(struct attrib **palist, const char *name);
-  extern const char *get_racename(struct attrib *alist);
+    extern void set_racename(struct attrib **palist, const char *name);
+    extern const char *get_racename(struct attrib *alist);
 
-  extern struct attrib_type at_racename;
+    extern struct attrib_type at_racename;
 
 #ifdef __cplusplus
 }
diff --git a/src/attributes/raceprefix.c b/src/attributes/raceprefix.c
index 22026d3cf..57d005d33 100644
--- a/src/attributes/raceprefix.c
+++ b/src/attributes/raceprefix.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -28,34 +28,35 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include <stdlib.h>
 
 attrib_type at_raceprefix = {
-  "raceprefix", NULL, a_finalizestring, NULL, a_writestring, a_readstring,
+    "raceprefix", NULL, a_finalizestring, NULL, a_writestring, a_readstring,
     ATF_UNIQUE
 };
 
 void set_prefix(attrib ** ap, const char *str)
 {
-  attrib *a = a_find(*ap, &at_raceprefix);
-  if (a == NULL) {
-    a = a_add(ap, a_new(&at_raceprefix));
-  } else {
-    free(a->data.v);
-  }
-  assert(a->type == &at_raceprefix);
-  a->data.v = _strdup(str);
+    attrib *a = a_find(*ap, &at_raceprefix);
+    if (a == NULL) {
+        a = a_add(ap, a_new(&at_raceprefix));
+    }
+    else {
+        free(a->data.v);
+    }
+    assert(a->type == &at_raceprefix);
+    a->data.v = _strdup(str);
 }
 
 const char *get_prefix(const attrib * a)
 {
-  char *str;
-  a = a_findc(a, &at_raceprefix);
-  if (a == NULL)
-    return NULL;
-  str = (char *)a->data.v;
-  /* conversion of old prefixes */
-  if (strncmp(str, "prefix_", 7) == 0) {
-    ((attrib *) a)->data.v = _strdup(str + 7);
-    free(str);
+    char *str;
+    a = a_findc(a, &at_raceprefix);
+    if (a == NULL)
+        return NULL;
     str = (char *)a->data.v;
-  }
-  return str;
+    /* conversion of old prefixes */
+    if (strncmp(str, "prefix_", 7) == 0) {
+        ((attrib *)a)->data.v = _strdup(str + 7);
+        free(str);
+        str = (char *)a->data.v;
+    }
+    return str;
 }
diff --git a/src/attributes/raceprefix.h b/src/attributes/raceprefix.h
index 312b497a8..f322b464f 100644
--- a/src/attributes/raceprefix.h
+++ b/src/attributes/raceprefix.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,9 +22,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  extern struct attrib_type at_raceprefix;
-  extern void set_prefix(struct attrib **ap, const char *str);
-  extern const char *get_prefix(const struct attrib *a);
+    extern struct attrib_type at_raceprefix;
+    extern void set_prefix(struct attrib **ap, const char *str);
+    extern const char *get_prefix(const struct attrib *a);
 
 #ifdef __cplusplus
 }
diff --git a/src/attributes/reduceproduction.c b/src/attributes/reduceproduction.c
index ba7f905bb..414d8aff6 100644
--- a/src/attributes/reduceproduction.c
+++ b/src/attributes/reduceproduction.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -24,27 +24,27 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 static int age_reduceproduction(attrib * a)
 {
-  int reduce = 100 - (5 * --a->data.sa[1]);
-  if (reduce < 10)
-    reduce = 10;
-  a->data.sa[0] = (short)reduce;
-  return (a->data.sa[1] > 0) ? AT_AGE_KEEP : AT_AGE_REMOVE;
+    int reduce = 100 - (5 * --a->data.sa[1]);
+    if (reduce < 10)
+        reduce = 10;
+    a->data.sa[0] = (short)reduce;
+    return (a->data.sa[1] > 0) ? AT_AGE_KEEP : AT_AGE_REMOVE;
 }
 
 attrib_type at_reduceproduction = {
-  "reduceproduction",
-  NULL,
-  NULL,
-  age_reduceproduction,
-  a_writeshorts,
-  a_readshorts,
-  ATF_UNIQUE
+    "reduceproduction",
+    NULL,
+    NULL,
+    age_reduceproduction,
+    a_writeshorts,
+    a_readshorts,
+    ATF_UNIQUE
 };
 
 attrib *make_reduceproduction(int percent, int time)
 {
-  attrib *a = a_new(&at_reduceproduction);
-  a->data.sa[0] = (short)percent;
-  a->data.sa[1] = (short)time;
-  return a;
+    attrib *a = a_new(&at_reduceproduction);
+    a->data.sa[0] = (short)percent;
+    a->data.sa[1] = (short)time;
+    return a;
 }
diff --git a/src/attributes/reduceproduction.h b/src/attributes/reduceproduction.h
index c94f6fb01..1cf972f69 100644
--- a/src/attributes/reduceproduction.h
+++ b/src/attributes/reduceproduction.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,8 +22,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  extern struct attrib *make_reduceproduction(int percent, int time);
-  extern struct attrib_type at_reduceproduction;
+    extern struct attrib *make_reduceproduction(int percent, int time);
+    extern struct attrib_type at_reduceproduction;
 
 #ifdef __cplusplus
 }
diff --git a/src/attributes/targetregion.c b/src/attributes/targetregion.c
index f33b1007f..626ead9ab 100644
--- a/src/attributes/targetregion.c
+++ b/src/attributes/targetregion.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -32,32 +32,32 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 static void
 write_targetregion(const attrib * a, const void *owner, struct storage *store)
 {
-  write_region_reference((region *) a->data.v, store);
+    write_region_reference((region *)a->data.v, store);
 }
 
 static int read_targetregion(attrib * a, void *owner, struct storage *store)
 {
-  int result =
-    read_reference(&a->data.v, store, read_region_reference,
-    RESOLVE_REGION(global.data_version));
-  if (result == 0 && !a->data.v)
-    return AT_READ_FAIL;
-  return AT_READ_OK;
+    int result =
+        read_reference(&a->data.v, store, read_region_reference,
+        RESOLVE_REGION(global.data_version));
+    if (result == 0 && !a->data.v)
+        return AT_READ_FAIL;
+    return AT_READ_OK;
 }
 
 attrib_type at_targetregion = {
-  "targetregion",
-  NULL,
-  NULL,
-  NULL,
-  write_targetregion,
-  read_targetregion,
-  ATF_UNIQUE
+    "targetregion",
+    NULL,
+    NULL,
+    NULL,
+    write_targetregion,
+    read_targetregion,
+    ATF_UNIQUE
 };
 
 attrib *make_targetregion(struct region * r)
 {
-  attrib *a = a_new(&at_targetregion);
-  a->data.v = r;
-  return a;
+    attrib *a = a_new(&at_targetregion);
+    a->data.v = r;
+    return a;
 }
diff --git a/src/attributes/targetregion.h b/src/attributes/targetregion.h
index 950e1634a..cce0cce62 100644
--- a/src/attributes/targetregion.h
+++ b/src/attributes/targetregion.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,10 +22,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  extern struct attrib_type at_targetregion;
+    extern struct attrib_type at_targetregion;
 
-  struct region;
-  extern struct attrib *make_targetregion(struct region *);
+    struct region;
+    extern struct attrib *make_targetregion(struct region *);
 
 #ifdef __cplusplus
 }
diff --git a/src/battle.c b/src/battle.c
index ed4354049..55cca4660 100644
--- a/src/battle.c
+++ b/src/battle.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
@@ -214,11 +214,11 @@ void message_all(battle * b, message * m)
     }
     if (p)
         for (w = p->watchers; w; w = w->next) {
-        for (bf = b->factions; bf; bf = bf->next)
-            if (bf->faction == w->faction)
-                break;
-        if (bf == NULL)
-            message_faction(b, w->faction, m);
+            for (bf = b->factions; bf; bf = bf->next)
+                if (bf->faction == w->faction)
+                    break;
+            if (bf == NULL)
+                message_faction(b, w->faction, m);
         }
 }
 
@@ -458,7 +458,7 @@ int get_unitrow(const fighter * af, const side * vs)
         assert(i == b->rowcache.result);
     }
 #endif
-        return b->rowcache.result;
+    return b->rowcache.result;
     }
 }
 
@@ -1325,11 +1325,11 @@ terminate(troop dt, troop at, int type, const char *damage, bool missile)
             heiltrank = 1;
         }
         if (heiltrank && (chance(0.50))) {
-                {
-                    message *m = msg_message("battle::potionsave", "unit", du);
-                    message_faction(b, du->faction, m);
-                    msg_release(m);
-                }
+            {
+                message *m = msg_message("battle::potionsave", "unit", du);
+                message_faction(b, du->faction, m);
+                msg_release(m);
+            }
             assert(dt.index >= 0 && dt.index < du->number);
             df->person[dt.index].hp = u_race(du)->hitpoints;
             return false;
diff --git a/src/battle.h b/src/battle.h
index 5dbec1ecb..f0a4e71a3 100644
--- a/src/battle.h
+++ b/src/battle.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -25,13 +25,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  /** more defines **/
+    /** more defines **/
 #define FS_ENEMY 1
 #define FS_HELP  2
 
-  /***** Verteidigungslinien.
-  * Eressea hat 4 Verteidigungslinien. 1 ist vorn, 5. enth�lt Summen 
-  */
+    /***** Verteidigungslinien.
+    * Eressea hat 4 Verteidigungslinien. 1 ist vorn, 5. enth�lt Summen
+    */
 
 #define NUMROWS 5
 #define SUM_ROW 0
@@ -43,93 +43,93 @@ extern "C" {
 #define FIRST_ROW FIGHT_ROW
 #define MAXSIDES 192            /* if there are ever more than this, we're fucked. */
 
-  struct message;
+    struct message;
 
-  typedef struct bfaction {
-    struct bfaction *next;
-    struct side *sides;
-    struct faction *faction;
-    bool attacker;
-  } bfaction;
+    typedef struct bfaction {
+        struct bfaction *next;
+        struct side *sides;
+        struct faction *faction;
+        bool attacker;
+    } bfaction;
 
-  typedef struct tactics {
-    struct quicklist *fighters;
-    int value;
-  } tactics;
+    typedef struct tactics {
+        struct quicklist *fighters;
+        int value;
+    } tactics;
 
 #define SIDE_STEALTH   1<<0
 #define SIDE_HASGUARDS  1<<1
-  typedef struct side {
-    struct side *nextF;         /* next army of same faction */
-    struct battle *battle;
-    struct bfaction *bf;        /* battle info that goes with the faction */
-    struct faction *faction;    /* cache optimization for bf->faction */
-    const struct group *group;
-    struct tactics leader;      /* this army's best tactician */
+    typedef struct side {
+        struct side *nextF;         /* next army of same faction */
+        struct battle *battle;
+        struct bfaction *bf;        /* battle info that goes with the faction */
+        struct faction *faction;    /* cache optimization for bf->faction */
+        const struct group *group;
+        struct tactics leader;      /* this army's best tactician */
 # define E_ENEMY 1
 # define E_FRIEND 2
 # define E_ATTACKING 4
-    unsigned char relations[MAXSIDES];
-    struct side *enemies[MAXSIDES];
-    struct fighter *fighters;
-    int index;                  /* Eintrag der Fraktion in b->matrix/b->enemies */
-    int size[NUMROWS];          /* Anzahl Personen in Reihe X. 0 = Summe */
-    int nonblockers[NUMROWS];   /* Anzahl nichtblockierender K�mpfer, z.B. Schattenritter. */
-    int alive;                  /* Die Partei hat den Kampf verlassen */
-    int removed;                /* stoned */
-    int flee;
-    int dead;
-    int casualties;             /* those dead that were real people, not undead! */
-    int healed;
-    unsigned int flags;
-    const struct faction *stealthfaction;
-  } side;
+        unsigned char relations[MAXSIDES];
+        struct side *enemies[MAXSIDES];
+        struct fighter *fighters;
+        int index;                  /* Eintrag der Fraktion in b->matrix/b->enemies */
+        int size[NUMROWS];          /* Anzahl Personen in Reihe X. 0 = Summe */
+        int nonblockers[NUMROWS];   /* Anzahl nichtblockierender K�mpfer, z.B. Schattenritter. */
+        int alive;                  /* Die Partei hat den Kampf verlassen */
+        int removed;                /* stoned */
+        int flee;
+        int dead;
+        int casualties;             /* those dead that were real people, not undead! */
+        int healed;
+        unsigned int flags;
+        const struct faction *stealthfaction;
+    } side;
 
-  typedef struct battle {
-    struct quicklist *leaders;
-    struct region *region;
-    struct plane *plane;
-    bfaction *factions;
-    int nfactions;
-    int nfighters;
-    side sides[MAXSIDES];
-    int nsides;
-    struct quicklist *meffects;
-    int max_tactics;
-    int turn;
-    bool has_tactics_turn;
-    int keeploot;
-    bool reelarrow;
-    int alive;
-    struct {
-      const struct side *as;
-      const struct side *vs;
-      int alive;
-      int row;
-      int result;
-    } rowcache;
-    struct {
-      struct side *side;
-      int status;
-      int alive;
-      int minrow, maxrow;
-      int enemies[8];
-    } fast;
-  } battle;
+    typedef struct battle {
+        struct quicklist *leaders;
+        struct region *region;
+        struct plane *plane;
+        bfaction *factions;
+        int nfactions;
+        int nfighters;
+        side sides[MAXSIDES];
+        int nsides;
+        struct quicklist *meffects;
+        int max_tactics;
+        int turn;
+        bool has_tactics_turn;
+        int keeploot;
+        bool reelarrow;
+        int alive;
+        struct {
+            const struct side *as;
+            const struct side *vs;
+            int alive;
+            int row;
+            int result;
+        } rowcache;
+        struct {
+            struct side *side;
+            int status;
+            int alive;
+            int minrow, maxrow;
+            int enemies[8];
+        } fast;
+    } battle;
 
-  typedef struct weapon {
-    int count, used;
-    const struct weapon_type *type;
+    typedef struct weapon {
+        int count, used;
+        const struct weapon_type *type;
 # ifdef LOMEM
-    int attackskill:8;
-    int defenseskill:8;
+        int attackskill : 8;
+        int defenseskill : 8;
 # else
-    int attackskill;
-    int defenseskill;
+        int attackskill;
+        int defenseskill;
 # endif
-  } weapon;
+    } weapon;
 
-  /*** fighter::person::flags ***/
+    /*** fighter::person::flags ***/
 #define FL_TIRED	  1
 #define FL_DAZZLED  2           /* durch Untote oder D�monen eingesch�chtert */
 #define FL_PANICED  4
@@ -138,140 +138,140 @@ extern "C" {
 #define FL_STUNNED	32      /* eine Runde keinen Angriff */
 #define FL_HIT    	64      /* the person at attacked */
 
-  typedef struct troop {
-    struct fighter *fighter;
-    int index;
-  } troop;
+    typedef struct troop {
+        struct fighter *fighter;
+        int index;
+    } troop;
 
-  typedef struct armor {
-    struct armor *next;
-    const struct armor_type *atype;
-    int count;
-  } armor;
+    typedef struct armor {
+        struct armor *next;
+        const struct armor_type *atype;
+        int count;
+    } armor;
 
-  /*** fighter::flags ***/
+    /*** fighter::flags ***/
 #define FIG_ATTACKER   1<<0
 #define FIG_NOLOOT     1<<1
-  typedef struct fighter {
-    struct fighter *next;
-    struct side *side;
-    struct unit *unit;          /* Die Einheit, die hier k�mpft */
-    struct building *building;  /* Geb�ude, in dem die Einheit evtl. steht */
-    status_t status;            /* Kampfstatus */
-    struct weapon *weapons;
-    struct armor *armors;       /* Anzahl R�stungen jeden Typs */
-    int alive;                  /* Anzahl der noch nicht Toten in der Einheit */
-    int fighting;               /* Anzahl der K�mpfer in der aktuellen Runde */
-    int removed;                /* Anzahl Kaempfer, die nicht tot sind, aber
-                                   aus dem Kampf raus sind (zB weil sie
-                                   versteinert wurden).  Diese werden auch
-                                   in alive noch mitgez�hlt! */
-    int magic;                  /* Magietalent der Einheit  */
-    int horses;                 /* Anzahl brauchbarer Pferde der Einheit */
-    int elvenhorses;            /* Anzahl brauchbarer Elfenpferde der Einheit */
-    struct item *loot;
-    int catmsg;                 /* Merkt sich, ob Katapultmessage schon generiert. */
-    struct person {
-      int hp;                   /* Trefferpunkte der Personen */
+    typedef struct fighter {
+        struct fighter *next;
+        struct side *side;
+        struct unit *unit;          /* Die Einheit, die hier k�mpft */
+        struct building *building;  /* Geb�ude, in dem die Einheit evtl. steht */
+        status_t status;            /* Kampfstatus */
+        struct weapon *weapons;
+        struct armor *armors;       /* Anzahl R�stungen jeden Typs */
+        int alive;                  /* Anzahl der noch nicht Toten in der Einheit */
+        int fighting;               /* Anzahl der K�mpfer in der aktuellen Runde */
+        int removed;                /* Anzahl Kaempfer, die nicht tot sind, aber
+                                       aus dem Kampf raus sind (zB weil sie
+                                       versteinert wurden).  Diese werden auch
+                                       in alive noch mitgez�hlt! */
+        int magic;                  /* Magietalent der Einheit  */
+        int horses;                 /* Anzahl brauchbarer Pferde der Einheit */
+        int elvenhorses;            /* Anzahl brauchbarer Elfenpferde der Einheit */
+        struct item *loot;
+        int catmsg;                 /* Merkt sich, ob Katapultmessage schon generiert. */
+        struct person {
+            int hp;                   /* Trefferpunkte der Personen */
 #ifdef LOMEM
-      int attack:8;             /* (Magie) Attackenbonus der Personen */
-      int defence:8;            /* (Magie) Paradenbonus der Personen */
-      int damage:8;             /* (Magie) Schadensbonus der Personen im Nahkampf */
-      int damage_rear:8;        /* (Magie) Schadensbonus der Personen im Fernkampf */
-      int flags:8;              /* (Magie) Diverse Flags auf K�mpfern */
-      int speed:8;              /* (Magie) Geschwindigkeitsmultiplkator. */
-      int reload:4;             /* Anzahl Runden, die die Waffe x noch laden muss.
-                                 * dahinter steckt ein array[RL_MAX] wenn er min. eine hat. */
-      int last_action:4;        /* In welcher Runde haben wir zuletzt etwas getan */
+            int attack : 8;             /* (Magie) Attackenbonus der Personen */
+            int defence : 8;            /* (Magie) Paradenbonus der Personen */
+            int damage : 8;             /* (Magie) Schadensbonus der Personen im Nahkampf */
+            int damage_rear : 8;        /* (Magie) Schadensbonus der Personen im Fernkampf */
+            int flags : 8;              /* (Magie) Diverse Flags auf K�mpfern */
+            int speed : 8;              /* (Magie) Geschwindigkeitsmultiplkator. */
+            int reload : 4;             /* Anzahl Runden, die die Waffe x noch laden muss.
+                                       * dahinter steckt ein array[RL_MAX] wenn er min. eine hat. */
+            int last_action : 4;        /* In welcher Runde haben wir zuletzt etwas getan */
 #else
-      int attack;
-      int defence;
-      int damage;
-      int damage_rear;
-      int flags;
-      int speed;
-      int reload;
-      int last_action;
+            int attack;
+            int defence;
+            int damage;
+            int damage_rear;
+            int flags;
+            int speed;
+            int reload;
+            int last_action;
 #endif
-      struct weapon *missile;   /* missile weapon */
-      struct weapon *melee;     /* melee weapon */
-    } *person;
-    unsigned int flags;
-    struct {
-      int number;               /* number of people who fled */
-      int hp;                   /* accumulated hp of fleeing people */
-    } run;
-    int kills;
-    int hits;
-  } fighter;
+            struct weapon *missile;   /* missile weapon */
+            struct weapon *melee;     /* melee weapon */
+        } *person;
+        unsigned int flags;
+        struct {
+            int number;               /* number of people who fled */
+            int hp;                   /* accumulated hp of fleeing people */
+        } run;
+        int kills;
+        int hits;
+    } fighter;
 
-  /* schilde */
+    /* schilde */
 
-  enum {
-    SHIELD_REDUCE,
-    SHIELD_ARMOR,
-    SHIELD_WIND,
-    SHIELD_BLOCK,
-    SHIELD_MAX
-  };
+    enum {
+        SHIELD_REDUCE,
+        SHIELD_ARMOR,
+        SHIELD_WIND,
+        SHIELD_BLOCK,
+        SHIELD_MAX
+    };
 
-  typedef struct meffect {
-    fighter *magician;          /* Der Zauberer, der den Schild gezaubert hat */
-    int typ;                    /* Wirkungsweise des Schilds */
-    int effect;
-    int duration;
-  } meffect;
+    typedef struct meffect {
+        fighter *magician;          /* Der Zauberer, der den Schild gezaubert hat */
+        int typ;                    /* Wirkungsweise des Schilds */
+        int effect;
+        int duration;
+    } meffect;
 
-  extern const troop no_troop;
+    extern const troop no_troop;
 
-  /* BEGIN battle interface */
-  void battle_init(battle * b);
-  void battle_free(battle * b);
-  side * find_side(battle * b, const struct faction * f, const struct group * g, int flags, const struct faction * stealthfaction);
-  side * get_side(battle * b, const struct unit * u);
-  fighter * get_fighter(battle * b, const struct unit * u);
-  /* END battle interface */
+    /* BEGIN battle interface */
+    void battle_init(battle * b);
+    void battle_free(battle * b);
+    side * find_side(battle * b, const struct faction * f, const struct group * g, int flags, const struct faction * stealthfaction);
+    side * get_side(battle * b, const struct unit * u);
+    fighter * get_fighter(battle * b, const struct unit * u);
+    /* END battle interface */
 
-  extern void do_battle(struct region *r);
+    extern void do_battle(struct region *r);
 
-  /* for combat spells and special attacks */
-  enum { SELECT_ADVANCE = 0x1, SELECT_DISTANCE = 0x2, SELECT_FIND = 0x4 };
-  enum { ALLY_SELF, ALLY_ANY };
+    /* for combat spells and special attacks */
+    enum { SELECT_ADVANCE = 0x1, SELECT_DISTANCE = 0x2, SELECT_FIND = 0x4 };
+    enum { ALLY_SELF, ALLY_ANY };
 
-  extern troop select_enemy(struct fighter *af, int minrow, int maxrow,
-    int select);
-  extern troop select_ally(struct fighter *af, int minrow, int maxrow,
-    int allytype);
+    extern troop select_enemy(struct fighter *af, int minrow, int maxrow,
+        int select);
+    extern troop select_ally(struct fighter *af, int minrow, int maxrow,
+        int allytype);
+
+    extern int count_enemies(struct battle *b, const struct fighter *af,
+        int minrow, int maxrow, int select);
+    extern bool terminate(troop dt, troop at, int type, const char *damage,
+        bool missile);
+    extern void message_all(battle * b, struct message *m);
+    extern int hits(troop at, troop dt, weapon * awp);
+    extern void damage_building(struct battle *b, struct building *bldg,
+        int damage_abs);
+    extern struct quicklist *fighters(struct battle *b, const struct side *vs,
+        int minrow, int maxrow, int mask);
+    extern int count_allies(const struct side *as, int minrow, int maxrow,
+        int select, int allytype);
+    extern int get_unitrow(const struct fighter *af, const struct side *vs);
+    extern bool helping(const struct side *as, const struct side *ds);
+    extern void rmfighter(fighter * df, int i);
+    extern struct fighter *select_corpse(struct battle *b, struct fighter *af);
+    extern int statusrow(int status);
+    extern void drain_exp(struct unit *u, int d);
+    extern void kill_troop(troop dt);
+    extern void remove_troop(troop dt);   /* not the same as the badly named rmtroop */
 
-  extern int count_enemies(struct battle *b, const struct fighter *af,
-    int minrow, int maxrow, int select);
-  extern bool terminate(troop dt, troop at, int type, const char *damage,
-    bool missile);
-  extern void message_all(battle * b, struct message *m);
-  extern int hits(troop at, troop dt, weapon * awp);
-  extern void damage_building(struct battle *b, struct building *bldg,
-    int damage_abs);
-  extern struct quicklist *fighters(struct battle *b, const struct side *vs,
-    int minrow, int maxrow, int mask);
-  extern int count_allies(const struct side *as, int minrow, int maxrow,
-    int select, int allytype);
-  extern int get_unitrow(const struct fighter *af, const struct side *vs);
-  extern bool helping(const struct side *as, const struct side *ds);
-  extern void rmfighter(fighter * df, int i);
-  extern struct fighter *select_corpse(struct battle *b, struct fighter *af);
-  extern int statusrow(int status);
-  extern void drain_exp(struct unit *u, int d);
-  extern void kill_troop(troop dt);
-  extern void remove_troop(troop dt);   /* not the same as the badly named rmtroop */
-  
     bool is_attacker(const fighter * fig);
     struct battle *make_battle(struct region * r);
     void free_battle(struct battle * b);
     struct fighter *make_fighter(struct battle *b, struct unit *u,
-                                 struct side * s, bool attack);
+    struct side * s, bool attack);
     struct side *make_side(struct battle * b, const struct faction * f,
-                           const struct group * g, unsigned int flags, 
-                           const struct faction * stealthfaction);
+        const struct group * g, unsigned int flags,
+        const struct faction * stealthfaction);
     int skilldiff(troop at, troop dt, int dist);
 
 #ifdef __cplusplus
diff --git a/src/battle.test.c b/src/battle.test.c
index 1a329252c..53ec91922 100644
--- a/src/battle.test.c
+++ b/src/battle.test.c
@@ -36,11 +36,11 @@ static void test_make_fighter(CuTest * tc)
     au->status = ST_BEHIND;
     rtype = get_resourcetype(R_HORSE);
     i_change(&au->items, rtype->itype, 1);
-    
+
     b = make_battle(r);
     as = make_side(b, au->faction, 0, 0, 0);
     af = make_fighter(b, au, as, false);
-    
+
     CuAssertIntEquals(tc, 1, b->nfighters);
     CuAssertPtrEquals(tc, 0, af->building);
     CuAssertPtrEquals(tc, as, af->side);
@@ -59,7 +59,7 @@ static void test_make_fighter(CuTest * tc)
 }
 
 static int add_two(building * b, unit * u, building_bonus bonus) {
-  return 2;
+    return 2;
 }
 
 static void test_defenders_get_building_bonus(CuTest * tc)
@@ -190,11 +190,11 @@ static void test_building_defence_bonus(CuTest * tc)
     r = findregion(0, 0);
     register_buildings();
     btype = bt_get_or_create("castle");
-    btype->protection = (int (*)(struct building *, struct unit *, building_bonus))get_function("building_protection");
+    btype->protection = (int(*)(struct building *, struct unit *, building_bonus))get_function("building_protection");
     btype->construction->defense_bonus = 3;
     bld = test_create_building(r, btype);
     bld->size = 1;
-    
+
     f = test_create_faction(NULL);
     au = test_create_unit(f, r);
     scale_number(au, 1);
diff --git a/src/bind_building.c b/src/bind_building.c
index 491b9a7d7..ecd47d20f 100644
--- a/src/bind_building.c
+++ b/src/bind_building.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
 +-------------------+
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Christian Schlittchen <corwin@amber.kn-bremen.de>
@@ -27,27 +27,28 @@ without prior permission by the authors of Eressea.
 
 int tolua_buildinglist_next(lua_State * L)
 {
-  building **building_ptr =
-    (building **) lua_touserdata(L, lua_upvalueindex(1));
-  building *u = *building_ptr;
-  if (u != NULL) {
-    tolua_pushusertype(L, (void *)u, TOLUA_CAST "building");
-    *building_ptr = u->next;
-    return 1;
-  } else
-    return 0;                   /* no more values to return */
+    building **building_ptr =
+        (building **)lua_touserdata(L, lua_upvalueindex(1));
+    building *u = *building_ptr;
+    if (u != NULL) {
+        tolua_pushusertype(L, (void *)u, TOLUA_CAST "building");
+        *building_ptr = u->next;
+        return 1;
+    }
+    else
+        return 0;                   /* no more values to return */
 }
 
 static int tolua_building_get_objects(lua_State * L)
 {
-  building *self = (building *) tolua_tousertype(L, 1, 0);
-  tolua_pushusertype(L, (void *)&self->attribs, TOLUA_CAST "hashtable");
-  return 1;
+    building *self = (building *)tolua_tousertype(L, 1, 0);
+    tolua_pushusertype(L, (void *)&self->attribs, TOLUA_CAST "hashtable");
+    return 1;
 }
 
 static int tolua_building_set_working(lua_State * L)
 {
-    building *self = (building *) tolua_tousertype(L, 1, 0);
+    building *self = (building *)tolua_tousertype(L, 1, 0);
     bool flag = !!lua_toboolean(L, 2);
     if (flag) self->flags |= BLD_WORKING;
     else self->flags &= ~BLD_WORKING;
@@ -56,198 +57,198 @@ static int tolua_building_set_working(lua_State * L)
 
 static int tolua_building_get_working(lua_State * L)
 {
-    building *self = (building *) tolua_tousertype(L, 1, 0);
-    bool flag = (self->flags&BLD_WORKING)!=0;
+    building *self = (building *)tolua_tousertype(L, 1, 0);
+    bool flag = (self->flags&BLD_WORKING) != 0;
     lua_pushboolean(L, flag);
     return 1;
 }
 
 static int tolua_building_get_region(lua_State * L)
 {
-  building *self = (building *) tolua_tousertype(L, 1, 0);
-  tolua_pushusertype(L, building_getregion(self), TOLUA_CAST "region");
-  return 1;
+    building *self = (building *)tolua_tousertype(L, 1, 0);
+    tolua_pushusertype(L, building_getregion(self), TOLUA_CAST "region");
+    return 1;
 }
 
 static int tolua_building_set_region(lua_State * L)
 {
-  building *self = (building *) tolua_tousertype(L, 1, 0);
-  building_setregion(self, (region *) tolua_tousertype(L, 2, 0));
-  return 0;
+    building *self = (building *)tolua_tousertype(L, 1, 0);
+    building_setregion(self, (region *)tolua_tousertype(L, 2, 0));
+    return 0;
 }
 
 static int tolua_building_get_info(lua_State * L)
 {
-  building *self = (building *) tolua_tousertype(L, 1, 0);
-  tolua_pushstring(L, self->display);
-  return 1;
+    building *self = (building *)tolua_tousertype(L, 1, 0);
+    tolua_pushstring(L, self->display);
+    return 1;
 }
 
 static int tolua_building_set_info(lua_State * L)
 {
-  building *self = (building *) tolua_tousertype(L, 1, 0);
-  const char *info = tolua_tostring(L, 2, 0);
-  free(self->display);
-  if (info)
-    self->display = _strdup(info);
-  else
-    self->display = NULL;
-  return 0;
+    building *self = (building *)tolua_tousertype(L, 1, 0);
+    const char *info = tolua_tostring(L, 2, 0);
+    free(self->display);
+    if (info)
+        self->display = _strdup(info);
+    else
+        self->display = NULL;
+    return 0;
 }
 
 static int tolua_building_get_name(lua_State * L)
 {
-  building *self = (building *) tolua_tousertype(L, 1, 0);
-  tolua_pushstring(L, building_getname(self));
-  return 1;
+    building *self = (building *)tolua_tousertype(L, 1, 0);
+    tolua_pushstring(L, building_getname(self));
+    return 1;
 }
 
 static int tolua_building_set_name(lua_State * L)
 {
-  building *self = (building *) tolua_tousertype(L, 1, 0);
-  building_setname(self, tolua_tostring(L, 2, 0));
-  return 0;
+    building *self = (building *)tolua_tousertype(L, 1, 0);
+    building_setname(self, tolua_tostring(L, 2, 0));
+    return 0;
 }
 
 static int tolua_building_get_size(lua_State * L)
 {
-  building *self = (building *) tolua_tousertype(L, 1, 0);
-  tolua_pushnumber(L, self->size);
-  return 1;
+    building *self = (building *)tolua_tousertype(L, 1, 0);
+    tolua_pushnumber(L, self->size);
+    return 1;
 }
 
 static int tolua_building_set_size(lua_State * L)
 {
-  building *self = (building *) tolua_tousertype(L, 1, 0);
-  self->size = (int)tolua_tonumber(L, 2, 0);
-  return 0;
+    building *self = (building *)tolua_tousertype(L, 1, 0);
+    self->size = (int)tolua_tonumber(L, 2, 0);
+    return 0;
 }
 
 static int tolua_building_get_units(lua_State * L)
 {
-  building *self = (building *) tolua_tousertype(L, 1, 0);
-  unit **unit_ptr = (unit **) lua_newuserdata(L, sizeof(unit *));
-  unit *u = self->region->units;
+    building *self = (building *)tolua_tousertype(L, 1, 0);
+    unit **unit_ptr = (unit **)lua_newuserdata(L, sizeof(unit *));
+    unit *u = self->region->units;
 
-  while (u && u->building != self)
-    u = u->next;
-  luaL_getmetatable(L, "unit");
-  lua_setmetatable(L, -2);
+    while (u && u->building != self)
+        u = u->next;
+    luaL_getmetatable(L, "unit");
+    lua_setmetatable(L, -2);
 
-  *unit_ptr = u;
+    *unit_ptr = u;
 
-  lua_pushcclosure(L, tolua_unitlist_nextb, 1);
-  return 1;
+    lua_pushcclosure(L, tolua_unitlist_nextb, 1);
+    return 1;
 }
 
 static int tolua_building_get_id(lua_State * L)
 {
-  building *self = (building *) tolua_tousertype(L, 1, 0);
-  tolua_pushnumber(L, (lua_Number) self->no);
-  return 1;
+    building *self = (building *)tolua_tousertype(L, 1, 0);
+    tolua_pushnumber(L, (lua_Number)self->no);
+    return 1;
 }
 
 static int tolua_building_get_type(lua_State * L)
 {
-  building *self = (building *) tolua_tousertype(L, 1, 0);
-  tolua_pushstring(L, self->type->_name);
-  return 1;
+    building *self = (building *)tolua_tousertype(L, 1, 0);
+    tolua_pushstring(L, self->type->_name);
+    return 1;
 }
 
 static int tolua_building_get_typename(lua_State * L)
 {
-  building *b = (building *) tolua_tousertype(L, 1, 0);
-  if (b) {
-    int size = (int)tolua_tonumber(L, 2, b->size);
-    tolua_pushstring(L, buildingtype(b->type, b, size));
-    return 1;
-  }
-  return 0;
+    building *b = (building *)tolua_tousertype(L, 1, 0);
+    if (b) {
+        int size = (int)tolua_tonumber(L, 2, b->size);
+        tolua_pushstring(L, buildingtype(b->type, b, size));
+        return 1;
+    }
+    return 0;
 }
 
 static int tolua_building_get_owner(lua_State * L)
 {
-  building *b = (building *) tolua_tousertype(L, 1, 0);
-  unit *u = b ? building_owner(b) : NULL;
-  tolua_pushusertype(L, u, TOLUA_CAST "unit");
-  return 1;
+    building *b = (building *)tolua_tousertype(L, 1, 0);
+    unit *u = b ? building_owner(b) : NULL;
+    tolua_pushusertype(L, u, TOLUA_CAST "unit");
+    return 1;
 }
 
 static int tolua_building_set_owner(lua_State * L)
 {
-  building *b = (building *) tolua_tousertype(L, 1, 0);
-  unit *u = (unit *) tolua_tousertype(L, 2, 0);
-  if (b!=u->building) {
-    u_set_building(u, b);
-  }
-  building_set_owner(u);
-  return 0;
+    building *b = (building *)tolua_tousertype(L, 1, 0);
+    unit *u = (unit *)tolua_tousertype(L, 2, 0);
+    if (b != u->building) {
+        u_set_building(u, b);
+    }
+    building_set_owner(u);
+    return 0;
 }
 
 static int tolua_building_create(lua_State * L)
 {
-  region *r = (region *) tolua_tousertype(L, 1, 0);
-  const char *bname = tolua_tostring(L, 2, 0);
-  if (bname) {
-    const building_type *btype = bt_find(bname);
-    if (btype) {
-      building *b = new_building(btype, r, default_locale);
-      tolua_pushusertype(L, (void *)b, TOLUA_CAST "building");
-      return 1;
+    region *r = (region *)tolua_tousertype(L, 1, 0);
+    const char *bname = tolua_tostring(L, 2, 0);
+    if (bname) {
+        const building_type *btype = bt_find(bname);
+        if (btype) {
+            building *b = new_building(btype, r, default_locale);
+            tolua_pushusertype(L, (void *)b, TOLUA_CAST "building");
+            return 1;
+        }
     }
-  }
-  return 0;
+    return 0;
 }
 
 static int tolua_building_tostring(lua_State * L)
 {
-  building *self = (building *) tolua_tousertype(L, 1, 0);
-  lua_pushstring(L, buildingname(self));
-  return 1;
+    building *self = (building *)tolua_tousertype(L, 1, 0);
+    lua_pushstring(L, buildingname(self));
+    return 1;
 }
 
 static int tolua_building_destroy(lua_State * L)
 {
-  building *self = (building *) tolua_tousertype(L, 1, 0);
-  remove_building(&self->region->buildings, self);
-  return 0;
+    building *self = (building *)tolua_tousertype(L, 1, 0);
+    remove_building(&self->region->buildings, self);
+    return 0;
 }
 
 void tolua_building_open(lua_State * L)
 {
-  /* register user types */
-  tolua_usertype(L, TOLUA_CAST "building");
+    /* register user types */
+    tolua_usertype(L, TOLUA_CAST "building");
 
-  tolua_module(L, NULL, 0);
-  tolua_beginmodule(L, NULL);
-  {
-    tolua_cclass(L, TOLUA_CAST "building", TOLUA_CAST "building", TOLUA_CAST "",
-      NULL);
-    tolua_beginmodule(L, TOLUA_CAST "building");
+    tolua_module(L, NULL, 0);
+    tolua_beginmodule(L, NULL);
     {
-      tolua_function(L, TOLUA_CAST "create", tolua_building_create);
-      tolua_function(L, TOLUA_CAST "destroy", tolua_building_destroy);
-      tolua_function(L, TOLUA_CAST "__tostring", tolua_building_tostring);
+        tolua_cclass(L, TOLUA_CAST "building", TOLUA_CAST "building", TOLUA_CAST "",
+            NULL);
+        tolua_beginmodule(L, TOLUA_CAST "building");
+        {
+            tolua_function(L, TOLUA_CAST "create", tolua_building_create);
+            tolua_function(L, TOLUA_CAST "destroy", tolua_building_destroy);
+            tolua_function(L, TOLUA_CAST "__tostring", tolua_building_tostring);
 
-      tolua_variable(L, TOLUA_CAST "id", tolua_building_get_id, NULL);
-      tolua_variable(L, TOLUA_CAST "owner", tolua_building_get_owner,
-        tolua_building_set_owner);
-      tolua_variable(L, TOLUA_CAST "type", tolua_building_get_type, NULL);
-      tolua_variable(L, TOLUA_CAST "name", tolua_building_get_name,
-        tolua_building_set_name);
-      tolua_variable(L, TOLUA_CAST "info", tolua_building_get_info,
-        tolua_building_set_info);
-      tolua_variable(L, TOLUA_CAST "units", tolua_building_get_units, NULL);
-      tolua_variable(L, TOLUA_CAST "region", tolua_building_get_region,
-        tolua_building_set_region);
-      tolua_variable(L, TOLUA_CAST "size", tolua_building_get_size,
-        tolua_building_set_size);
-      tolua_function(L, TOLUA_CAST "get_typename", tolua_building_get_typename);
-      tolua_variable(L, TOLUA_CAST "objects", tolua_building_get_objects, 0);
-      tolua_variable(L, TOLUA_CAST "working", tolua_building_get_working, tolua_building_set_working);
+            tolua_variable(L, TOLUA_CAST "id", tolua_building_get_id, NULL);
+            tolua_variable(L, TOLUA_CAST "owner", tolua_building_get_owner,
+                tolua_building_set_owner);
+            tolua_variable(L, TOLUA_CAST "type", tolua_building_get_type, NULL);
+            tolua_variable(L, TOLUA_CAST "name", tolua_building_get_name,
+                tolua_building_set_name);
+            tolua_variable(L, TOLUA_CAST "info", tolua_building_get_info,
+                tolua_building_set_info);
+            tolua_variable(L, TOLUA_CAST "units", tolua_building_get_units, NULL);
+            tolua_variable(L, TOLUA_CAST "region", tolua_building_get_region,
+                tolua_building_set_region);
+            tolua_variable(L, TOLUA_CAST "size", tolua_building_get_size,
+                tolua_building_set_size);
+            tolua_function(L, TOLUA_CAST "get_typename", tolua_building_get_typename);
+            tolua_variable(L, TOLUA_CAST "objects", tolua_building_get_objects, 0);
+            tolua_variable(L, TOLUA_CAST "working", tolua_building_get_working, tolua_building_set_working);
 
+        }
+        tolua_endmodule(L);
     }
     tolua_endmodule(L);
-  }
-  tolua_endmodule(L);
 }
diff --git a/src/bind_building.h b/src/bind_building.h
index a6168b66c..ec971546e 100644
--- a/src/bind_building.h
+++ b/src/bind_building.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
 +-------------------+
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Christian Schlittchen <corwin@amber.kn-bremen.de>
diff --git a/src/bind_config.c b/src/bind_config.c
index e40055ee6..66f3cb47f 100644
--- a/src/bind_config.c
+++ b/src/bind_config.c
@@ -30,22 +30,23 @@ int config_parse(const char *json)
 {
     cJSON * conf = cJSON_Parse(json);
     if (conf) {
-        json_config(conf); 
+        json_config(conf);
         cJSON_Delete(conf);
         init_locales();
         return 0;
-    } else {
+    }
+    else {
         int line;
         char buffer[10];
         const char *xp = json, *lp, *ep = cJSON_GetErrorPtr();
-        for (line=1,lp=xp;xp && xp<ep;++line,lp=xp+1) {
+        for (line = 1, lp = xp; xp && xp<ep; ++line, lp = xp + 1) {
             xp = strchr(lp, '\n');
-            if (xp>=ep) break;
+            if (xp >= ep) break;
         }
-        xp = (ep > json + 10) ? ep - 10 : json; 
+        xp = (ep > json + 10) ? ep - 10 : json;
         strncpy(buffer, xp, sizeof(buffer));
         buffer[9] = 0;
-        log_error("json parse error in line %d, position %d, near `%s`\n", line, ep-lp, buffer);
+        log_error("json parse error in line %d, position %d, near `%s`\n", line, ep - lp, buffer);
     }
     return 1;
 }
diff --git a/src/bind_config.h b/src/bind_config.h
index aa6efde05..4e71d3567 100644
--- a/src/bind_config.h
+++ b/src/bind_config.h
@@ -4,9 +4,9 @@
 extern "C" {
 #endif
 
-void config_reset(void);
-int config_parse(const char *json);
-int config_read(const char *filename, const char * relpath);
+    void config_reset(void);
+    int config_parse(const char *json);
+    int config_read(const char *filename, const char * relpath);
 
 #ifdef __cplusplus
 }
diff --git a/src/bind_dict.c b/src/bind_dict.c
index 07c967e50..52ebb86ba 100644
--- a/src/bind_dict.c
+++ b/src/bind_dict.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
 +-------------------+
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Christian Schlittchen <corwin@amber.kn-bremen.de>
diff --git a/src/bind_dict.h b/src/bind_dict.h
index 6e9647afa..a5476e413 100644
--- a/src/bind_dict.h
+++ b/src/bind_dict.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
 +-------------------+
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Christian Schlittchen <corwin@amber.kn-bremen.de>
diff --git a/src/bind_eressea.c b/src/bind_eressea.c
index 170a8cb08..270cb44e8 100755
--- a/src/bind_eressea.c
+++ b/src/bind_eressea.c
@@ -14,21 +14,21 @@
 
 
 void eressea_free_game(void) {
-  free_gamedata();
-  init_resources();
+    free_gamedata();
+    init_resources();
 }
 
 int eressea_read_game(const char * filename) {
-  return readgame(filename, false);
-} 
+    return readgame(filename, false);
+}
 
 int eressea_write_game(const char * filename) {
-  remove_empty_factions();
-  return writegame(filename);
+    remove_empty_factions();
+    return writegame(filename);
 }
 
 int eressea_read_orders(const char * filename) {
-  return readorders(filename);
+    return readorders(filename);
 }
 
 int eressea_export_json(const char * filename, int flags) {
diff --git a/src/bind_faction.c b/src/bind_faction.c
index 82e58dc7f..5f81aa040 100644
--- a/src/bind_faction.c
+++ b/src/bind_faction.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
 +-------------------+
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Christian Schlittchen <corwin@amber.kn-bremen.de>
@@ -37,179 +37,181 @@ without prior permission by the authors of Eressea.
 
 int tolua_factionlist_next(lua_State * L)
 {
-  faction **faction_ptr = (faction **) lua_touserdata(L, lua_upvalueindex(1));
-  faction *f = *faction_ptr;
-  if (f != NULL) {
-    tolua_pushusertype(L, (void *)f, TOLUA_CAST "faction");
-    *faction_ptr = f->next;
-    return 1;
-  } else
-    return 0;                   /* no more values to return */
+    faction **faction_ptr = (faction **)lua_touserdata(L, lua_upvalueindex(1));
+    faction *f = *faction_ptr;
+    if (f != NULL) {
+        tolua_pushusertype(L, (void *)f, TOLUA_CAST "faction");
+        *faction_ptr = f->next;
+        return 1;
+    }
+    else
+        return 0;                   /* no more values to return */
 }
 
 static int tolua_faction_get_units(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  unit **unit_ptr = (unit **) lua_newuserdata(L, sizeof(unit *));
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    unit **unit_ptr = (unit **)lua_newuserdata(L, sizeof(unit *));
 
-  luaL_getmetatable(L, TOLUA_CAST "unit");
-  lua_setmetatable(L, -2);
+    luaL_getmetatable(L, TOLUA_CAST "unit");
+    lua_setmetatable(L, -2);
 
-  *unit_ptr = self->units;
+    *unit_ptr = self->units;
 
-  lua_pushcclosure(L, tolua_unitlist_nextf, 1);
-  return 1;
+    lua_pushcclosure(L, tolua_unitlist_nextf, 1);
+    return 1;
 }
 
 int tolua_faction_add_item(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  const char *iname = tolua_tostring(L, 2, 0);
-  int number = (int)tolua_tonumber(L, 3, 0);
-  int result = -1;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    const char *iname = tolua_tostring(L, 2, 0);
+    int number = (int)tolua_tonumber(L, 3, 0);
+    int result = -1;
 
-  if (iname != NULL) {
-    const resource_type *rtype = rt_find(iname);
-    if (rtype && rtype->itype) {
-      item *i = i_change(&self->items, rtype->itype, number);
-      result = i ? i->number : 0;
-    }                           /* if (itype!=NULL) */
-  }
-  lua_pushnumber(L, result);
-  return 1;
+    if (iname != NULL) {
+        const resource_type *rtype = rt_find(iname);
+        if (rtype && rtype->itype) {
+            item *i = i_change(&self->items, rtype->itype, number);
+            result = i ? i->number : 0;
+        }                           /* if (itype!=NULL) */
+    }
+    lua_pushnumber(L, result);
+    return 1;
 }
 
 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;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    tolua_pushnumber(L, (lua_Number)maxheroes(self));
+    return 1;
 }
 
 static int tolua_faction_get_heroes(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  tolua_pushnumber(L, (lua_Number) countheroes(self));
-  return 1;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    tolua_pushnumber(L, (lua_Number)countheroes(self));
+    return 1;
 }
 
 static int tolua_faction_get_score(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  tolua_pushnumber(L, (lua_Number) self->score);
-  return 1;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    tolua_pushnumber(L, (lua_Number)self->score);
+    return 1;
 }
 
 static int tolua_faction_get_id(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  tolua_pushnumber(L, (lua_Number) self->no);
-  return 1;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    tolua_pushnumber(L, (lua_Number)self->no);
+    return 1;
 }
 
 static int tolua_faction_set_id(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  int id = (int)tolua_tonumber(L, 2, 0);
-  if (findfaction(id) == NULL) {
-    renumber_faction(self, id);
-    lua_pushboolean(L, 1);
-  } else {
-    lua_pushboolean(L, 0);
-  }
-  return 1;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    int id = (int)tolua_tonumber(L, 2, 0);
+    if (findfaction(id) == NULL) {
+        renumber_faction(self, id);
+        lua_pushboolean(L, 1);
+    }
+    else {
+        lua_pushboolean(L, 0);
+    }
+    return 1;
 }
 
 static int tolua_faction_get_magic(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  lua_pushstring(L, magic_school[self->magiegebiet]);
-  return 1;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    lua_pushstring(L, magic_school[self->magiegebiet]);
+    return 1;
 }
 
 static int tolua_faction_set_magic(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  const char *type = tolua_tostring(L, 2, 0);
-  int mtype;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    const char *type = tolua_tostring(L, 2, 0);
+    int mtype;
 
-  for (mtype = 0; mtype != MAXMAGIETYP; ++mtype) {
-    if (strcmp(magic_school[mtype], type) == 0) {
-      self->magiegebiet = (magic_t)mtype;
-      break;
+    for (mtype = 0; mtype != MAXMAGIETYP; ++mtype) {
+        if (strcmp(magic_school[mtype], type) == 0) {
+            self->magiegebiet = (magic_t)mtype;
+            break;
+        }
     }
-  }
-  return 0;
+    return 0;
 }
 
 static int tolua_faction_get_age(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  tolua_pushnumber(L, (lua_Number) self->age);
-  return 1;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    tolua_pushnumber(L, (lua_Number)self->age);
+    return 1;
 }
 
 static int tolua_faction_set_age(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  int age = (int)tolua_tonumber(L, 2, 0);
-  self->age = age;
-  return 0;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    int age = (int)tolua_tonumber(L, 2, 0);
+    self->age = age;
+    return 0;
 }
 
 static int tolua_faction_get_flags(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  tolua_pushnumber(L, (lua_Number) self->flags);
-  return 1;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    tolua_pushnumber(L, (lua_Number)self->flags);
+    return 1;
 }
 
 static int tolua_faction_set_flags(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  int flags = (int)tolua_tonumber(L, 2, self->flags);
-  self->flags = flags;
-  return 1;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    int flags = (int)tolua_tonumber(L, 2, self->flags);
+    self->flags = flags;
+    return 1;
 }
 
 static int tolua_faction_get_options(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  tolua_pushnumber(L, (lua_Number) self->options);
-  return 1;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    tolua_pushnumber(L, (lua_Number)self->options);
+    return 1;
 }
 
 static int tolua_faction_set_options(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  int options = (int)tolua_tonumber(L, 2, self->options);
-  self->options = options;
-  return 1;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    int options = (int)tolua_tonumber(L, 2, self->options);
+    self->options = options;
+    return 1;
 }
 
 static int tolua_faction_get_lastturn(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  tolua_pushnumber(L, (lua_Number) self->lastorders);
-  return 1;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    tolua_pushnumber(L, (lua_Number)self->lastorders);
+    return 1;
 }
 
 static int tolua_faction_set_lastturn(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  if (self) {
-    self->lastorders = (int)tolua_tonumber(L, 2, self->lastorders);
-  }
-  return 0;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    if (self) {
+        self->lastorders = (int)tolua_tonumber(L, 2, self->lastorders);
+    }
+    return 0;
 }
 
 static int tolua_faction_renumber(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  int no = (int)tolua_tonumber(L, 2, 0);
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    int no = (int)tolua_tonumber(L, 2, 0);
 
-  renumber_faction(self, no);
-  return 0;
+    renumber_faction(self, no);
+    return 0;
 }
 
 static int tolua_faction_addnotice(lua_State * L)
@@ -223,107 +225,109 @@ static int tolua_faction_addnotice(lua_State * L)
 
 static int tolua_faction_get_objects(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  tolua_pushusertype(L, (void *)&self->attribs, TOLUA_CAST "hashtable");
-  return 1;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    tolua_pushusertype(L, (void *)&self->attribs, TOLUA_CAST "hashtable");
+    return 1;
 }
 
 static int tolua_faction_get_policy(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  faction *other = (faction *) tolua_tousertype(L, 2, 0);
-  const char *policy = tolua_tostring(L, 3, 0);
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    faction *other = (faction *)tolua_tousertype(L, 2, 0);
+    const char *policy = tolua_tostring(L, 3, 0);
 
-  int result = 0, mode;
-  for (mode = 0; helpmodes[mode].name != NULL; ++mode) {
-    if (strcmp(policy, helpmodes[mode].name) == 0) {
-      result = get_alliance(self, other) & mode;
-      break;
+    int result = 0, mode;
+    for (mode = 0; helpmodes[mode].name != NULL; ++mode) {
+        if (strcmp(policy, helpmodes[mode].name) == 0) {
+            result = get_alliance(self, other) & mode;
+            break;
+        }
     }
-  }
 
-  tolua_pushnumber(L, (lua_Number) result);
-  return 1;
+    tolua_pushnumber(L, (lua_Number)result);
+    return 1;
 }
 
 static int tolua_faction_set_policy(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  faction *other = (faction *) tolua_tousertype(L, 2, 0);
-  const char *policy = tolua_tostring(L, 3, 0);
-  int value = tolua_toboolean(L, 4, 0);
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    faction *other = (faction *)tolua_tousertype(L, 2, 0);
+    const char *policy = tolua_tostring(L, 3, 0);
+    int value = tolua_toboolean(L, 4, 0);
 
-  int mode;
-  for (mode = 0; helpmodes[mode].name != NULL; ++mode) {
-    if (strcmp(policy, helpmodes[mode].name) == 0) {
-      if (value) {
-        set_alliance(self, other, get_alliance(self,
-            other) | helpmodes[mode].status);
-      } else {
-        set_alliance(self, other, get_alliance(self,
-            other) & ~helpmodes[mode].status);
-      }
-      break;
+    int mode;
+    for (mode = 0; helpmodes[mode].name != NULL; ++mode) {
+        if (strcmp(policy, helpmodes[mode].name) == 0) {
+            if (value) {
+                set_alliance(self, other, get_alliance(self,
+                    other) | helpmodes[mode].status);
+            }
+            else {
+                set_alliance(self, other, get_alliance(self,
+                    other) & ~helpmodes[mode].status);
+            }
+            break;
+        }
     }
-  }
 
-  return 0;
+    return 0;
 }
 
 static int tolua_faction_normalize(lua_State * L)
 {
-  faction *f = (faction *) tolua_tousertype(L, 1, 0);
-  region *r = (region *) tolua_tousertype(L, 2, 0);
-  if (r) {
-    plane *pl = rplane(r);
-    int nx = r->x, ny = r->y;
-    pnormalize(&nx, &ny, pl);
-    adjust_coordinates(f, &nx, &ny, pl, r);
-    tolua_pushnumber(L, (lua_Number) nx);
-    tolua_pushnumber(L, (lua_Number) ny);
-    return 2;
-  }
-  return 0;
+    faction *f = (faction *)tolua_tousertype(L, 1, 0);
+    region *r = (region *)tolua_tousertype(L, 2, 0);
+    if (r) {
+        plane *pl = rplane(r);
+        int nx = r->x, ny = r->y;
+        pnormalize(&nx, &ny, pl);
+        adjust_coordinates(f, &nx, &ny, pl, r);
+        tolua_pushnumber(L, (lua_Number)nx);
+        tolua_pushnumber(L, (lua_Number)ny);
+        return 2;
+    }
+    return 0;
 }
 
 static int tolua_faction_set_origin(lua_State * L)
 {
-  faction *f = (faction *) tolua_tousertype(L, 1, 0);
-  region *r = (region *) tolua_tousertype(L, 2, 0);
-  plane *pl = rplane(r);
-  int id = pl ? pl->id : 0;
+    faction *f = (faction *)tolua_tousertype(L, 1, 0);
+    region *r = (region *)tolua_tousertype(L, 2, 0);
+    plane *pl = rplane(r);
+    int id = pl ? pl->id : 0;
 
-  set_ursprung(f, id, r->x - plane_center_x(pl), r->y - plane_center_y(pl));
-  return 0;
+    set_ursprung(f, id, r->x - plane_center_x(pl), r->y - plane_center_y(pl));
+    return 0;
 }
 
 static int tolua_faction_get_origin(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
 
-  ursprung *origin = self->ursprung;
-  int x, y;
-  while (origin != NULL && origin->id != 0) {
-    origin = origin->next;
-  }
-  if (origin) {
-    x = origin->x;
-    y = origin->y;
-  } else {
-    x = 0;
-    y = 0;
-  }
+    ursprung *origin = self->ursprung;
+    int x, y;
+    while (origin != NULL && origin->id != 0) {
+        origin = origin->next;
+    }
+    if (origin) {
+        x = origin->x;
+        y = origin->y;
+    }
+    else {
+        x = 0;
+        y = 0;
+    }
 
-  tolua_pushnumber(L, (lua_Number) x);
-  tolua_pushnumber(L, (lua_Number) y);
-  return 2;
+    tolua_pushnumber(L, (lua_Number)x);
+    tolua_pushnumber(L, (lua_Number)y);
+    return 2;
 }
 
 static int tolua_faction_destroy(lua_State * L)
 {
-  faction *f = (faction *) tolua_tousertype(L, 1, 0);
-  destroyfaction(f);
-  return 0;
+    faction *f = (faction *)tolua_tousertype(L, 1, 0);
+    destroyfaction(f);
+    return 0;
 }
 
 static int tolua_faction_get(lua_State * L)
@@ -336,138 +340,138 @@ static int tolua_faction_get(lua_State * L)
 
 static int tolua_faction_create(lua_State * L)
 {
-  const char *email = tolua_tostring(L, 1, 0);
-  const char *racename = tolua_tostring(L, 2, 0);
-  const char *lang = tolua_tostring(L, 3, 0);
-  struct locale *loc = get_locale(lang);
-  faction *f = NULL;
-  const struct race *frace = rc_find(racename);
-  if (frace != NULL) {
-    f = addfaction(email, NULL, frace, loc, 0);
-  }
-  if (!f) {
-    log_error("faction.create(%s, %s, %s)\n", email, racename, lang);
-  }
-  tolua_pushusertype(L, f, TOLUA_CAST "faction");
-  return 1;
+    const char *email = tolua_tostring(L, 1, 0);
+    const char *racename = tolua_tostring(L, 2, 0);
+    const char *lang = tolua_tostring(L, 3, 0);
+    struct locale *loc = get_locale(lang);
+    faction *f = NULL;
+    const struct race *frace = rc_find(racename);
+    if (frace != NULL) {
+        f = addfaction(email, NULL, frace, loc, 0);
+    }
+    if (!f) {
+        log_error("faction.create(%s, %s, %s)\n", email, racename, lang);
+    }
+    tolua_pushusertype(L, f, TOLUA_CAST "faction");
+    return 1;
 }
 
 static int tolua_faction_get_password(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  tolua_pushstring(L, faction_getpassword(self));
-  return 1;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    tolua_pushstring(L, faction_getpassword(self));
+    return 1;
 }
 
 static int tolua_faction_set_password(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  faction_setpassword(self, tolua_tostring(L, 2, 0));
-  return 0;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    faction_setpassword(self, tolua_tostring(L, 2, 0));
+    return 0;
 }
 
 static int tolua_faction_get_email(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  tolua_pushstring(L, faction_getemail(self));
-  return 1;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    tolua_pushstring(L, faction_getemail(self));
+    return 1;
 }
 
 static int tolua_faction_set_email(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  faction_setemail(self, tolua_tostring(L, 2, 0));
-  return 0;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    faction_setemail(self, tolua_tostring(L, 2, 0));
+    return 0;
 }
 
 static int tolua_faction_get_locale(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  tolua_pushstring(L, locale_name(self->locale));
-  return 1;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    tolua_pushstring(L, locale_name(self->locale));
+    return 1;
 }
 
 static int tolua_faction_set_locale(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  const char *name = tolua_tostring(L, 2, 0);
-  const struct locale *loc = get_locale(name);
-  if (loc) {
-      self->locale = loc;
-  }
-  else {
-      tolua_pushstring(L, "invalid locale");
-      return 1;
-  }
-  return 0;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    const char *name = tolua_tostring(L, 2, 0);
+    const struct locale *loc = get_locale(name);
+    if (loc) {
+        self->locale = loc;
+    }
+    else {
+        tolua_pushstring(L, "invalid locale");
+        return 1;
+    }
+    return 0;
 }
 
 static int tolua_faction_get_race(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  tolua_pushstring(L, self->race->_name);
-  return 1;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    tolua_pushstring(L, self->race->_name);
+    return 1;
 }
 
 static int tolua_faction_set_race(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  const char *name = tolua_tostring(L, 2, 0);
-  const race *rc = rc_find(name);
-  if (rc != NULL) {
-    self->race = rc;
-  }
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    const char *name = tolua_tostring(L, 2, 0);
+    const race *rc = rc_find(name);
+    if (rc != NULL) {
+        self->race = rc;
+    }
 
-  return 0;
+    return 0;
 }
 
 static int tolua_faction_get_name(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  tolua_pushstring(L, faction_getname(self));
-  return 1;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    tolua_pushstring(L, faction_getname(self));
+    return 1;
 }
 
 static int tolua_faction_set_name(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  faction_setname(self, tolua_tostring(L, 2, 0));
-  return 0;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    faction_setname(self, tolua_tostring(L, 2, 0));
+    return 0;
 }
 
 static int tolua_faction_get_uid(lua_State * L)
 {
-  faction *f = (faction *) tolua_tousertype(L, 1, 0);
-  tolua_pushnumber(L, f->subscription);
-  return 1;
+    faction *f = (faction *)tolua_tousertype(L, 1, 0);
+    tolua_pushnumber(L, f->subscription);
+    return 1;
 }
 
 static int tolua_faction_set_uid(lua_State * L)
 {
-  faction *f = (faction *) tolua_tousertype(L, 1, 0);
-  f->subscription = (int)tolua_tonumber(L, 2, 0);
-  return 0;
+    faction *f = (faction *)tolua_tousertype(L, 1, 0);
+    f->subscription = (int)tolua_tonumber(L, 2, 0);
+    return 0;
 }
 
 static int tolua_faction_get_info(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  tolua_pushstring(L, faction_getbanner(self));
-  return 1;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    tolua_pushstring(L, faction_getbanner(self));
+    return 1;
 }
 
 static int tolua_faction_set_info(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  faction_setbanner(self, tolua_tostring(L, 2, 0));
-  return 0;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    faction_setbanner(self, tolua_tostring(L, 2, 0));
+    return 0;
 }
 
 static int tolua_faction_get_alliance(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  tolua_pushusertype(L, f_get_alliance(self), TOLUA_CAST "alliance");
-  return 1;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    tolua_pushusertype(L, f_get_alliance(self), TOLUA_CAST "alliance");
+    return 1;
 }
 
 static int tolua_faction_set_alliance(lua_State * L)
@@ -475,115 +479,115 @@ static int tolua_faction_set_alliance(lua_State * L)
     struct faction *self = (struct faction *)tolua_tousertype(L, 1, 0);
     struct alliance *alli = (struct alliance *) tolua_tousertype(L, 2, 0);
 
-  setalliance(self, alli);
+    setalliance(self, alli);
 
-  return 0;
+    return 0;
 }
 
 static int tolua_faction_get_items(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  item **item_ptr = (item **) lua_newuserdata(L, sizeof(item *));
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    item **item_ptr = (item **)lua_newuserdata(L, sizeof(item *));
 
-  luaL_getmetatable(L, TOLUA_CAST "item");
-  lua_setmetatable(L, -2);
+    luaL_getmetatable(L, TOLUA_CAST "item");
+    lua_setmetatable(L, -2);
 
-  *item_ptr = self->items;
+    *item_ptr = self->items;
 
-  lua_pushcclosure(L, tolua_itemlist_next, 1);
+    lua_pushcclosure(L, tolua_itemlist_next, 1);
 
-  return 1;
+    return 1;
 }
 
 static int tolua_faction_tostring(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  lua_pushstring(L, factionname(self));
-  return 1;
+    faction *self = (faction *)tolua_tousertype(L, 1, 0);
+    lua_pushstring(L, factionname(self));
+    return 1;
 }
 
 #ifdef TODO /* these usertypes are undefined */
 static int tolua_faction_get_spells(lua_State * L)
 {
-  faction *self = (faction *) tolua_tousertype(L, 1, 0);
-  return tolua_quicklist_push(L, "spellbook", "spellbook_entry", self->spellbook->spells);
+    faction *self = (faction *) tolua_tousertype(L, 1, 0);
+    return tolua_quicklist_push(L, "spellbook", "spellbook_entry", self->spellbook->spells);
 }
 #endif
 
 void tolua_faction_open(lua_State * L)
 {
-  /* register user types */
-  tolua_usertype(L, TOLUA_CAST "faction");
-  tolua_usertype(L, TOLUA_CAST "faction_list");
+    /* register user types */
+    tolua_usertype(L, TOLUA_CAST "faction");
+    tolua_usertype(L, TOLUA_CAST "faction_list");
 
-  tolua_module(L, NULL, 0);
-  tolua_beginmodule(L, NULL);
-  {
-      tolua_function(L, TOLUA_CAST "get_faction", tolua_faction_get);
-      tolua_beginmodule(L, TOLUA_CAST "eressea");
-      tolua_function(L, TOLUA_CAST "faction", tolua_faction_get);
-      tolua_endmodule(L);
-      tolua_cclass(L, TOLUA_CAST "faction", TOLUA_CAST "faction", TOLUA_CAST "",
-      NULL);
-    tolua_beginmodule(L, TOLUA_CAST "faction");
+    tolua_module(L, NULL, 0);
+    tolua_beginmodule(L, NULL);
     {
-      tolua_function(L, TOLUA_CAST "__tostring", tolua_faction_tostring);
+        tolua_function(L, TOLUA_CAST "get_faction", tolua_faction_get);
+        tolua_beginmodule(L, TOLUA_CAST "eressea");
+        tolua_function(L, TOLUA_CAST "faction", tolua_faction_get);
+        tolua_endmodule(L);
+        tolua_cclass(L, TOLUA_CAST "faction", TOLUA_CAST "faction", TOLUA_CAST "",
+            NULL);
+        tolua_beginmodule(L, TOLUA_CAST "faction");
+        {
+            tolua_function(L, TOLUA_CAST "__tostring", tolua_faction_tostring);
 
-      tolua_variable(L, TOLUA_CAST "id", tolua_faction_get_id,
-        tolua_faction_set_id);
-      tolua_variable(L, TOLUA_CAST "uid", &tolua_faction_get_uid,
-        &tolua_faction_set_uid);
-      tolua_variable(L, TOLUA_CAST "name", &tolua_faction_get_name,
-        &tolua_faction_set_name);
-      tolua_variable(L, TOLUA_CAST "info", &tolua_faction_get_info,
-        &tolua_faction_set_info);
-      tolua_variable(L, TOLUA_CAST "units", tolua_faction_get_units, NULL);
-      tolua_variable(L, TOLUA_CAST "heroes", tolua_faction_get_heroes, NULL);
+            tolua_variable(L, TOLUA_CAST "id", tolua_faction_get_id,
+                tolua_faction_set_id);
+            tolua_variable(L, TOLUA_CAST "uid", &tolua_faction_get_uid,
+                &tolua_faction_set_uid);
+            tolua_variable(L, TOLUA_CAST "name", &tolua_faction_get_name,
+                &tolua_faction_set_name);
+            tolua_variable(L, TOLUA_CAST "info", &tolua_faction_get_info,
+                &tolua_faction_set_info);
+            tolua_variable(L, TOLUA_CAST "units", tolua_faction_get_units, NULL);
+            tolua_variable(L, TOLUA_CAST "heroes", tolua_faction_get_heroes, NULL);
 #ifdef TODO
-      tolua_variable(L, TOLUA_CAST "spells", tolua_faction_get_spells, 0);
+            tolua_variable(L, TOLUA_CAST "spells", tolua_faction_get_spells, 0);
 #endif
-      tolua_variable(L, TOLUA_CAST "maxheroes", tolua_faction_get_maxheroes,
-        NULL);
-      tolua_variable(L, TOLUA_CAST "password", tolua_faction_get_password,
-        tolua_faction_set_password);
-      tolua_variable(L, TOLUA_CAST "email", tolua_faction_get_email,
-        tolua_faction_set_email);
-      tolua_variable(L, TOLUA_CAST "locale", tolua_faction_get_locale,
-        tolua_faction_set_locale);
-      tolua_variable(L, TOLUA_CAST "race", tolua_faction_get_race,
-        tolua_faction_set_race);
-      tolua_variable(L, TOLUA_CAST "alliance", tolua_faction_get_alliance,
-        tolua_faction_set_alliance);
-      tolua_variable(L, TOLUA_CAST "score", tolua_faction_get_score, NULL);
-      tolua_variable(L, TOLUA_CAST "magic", &tolua_faction_get_magic,
-        tolua_faction_set_magic);
-      tolua_variable(L, TOLUA_CAST "age", tolua_faction_get_age,
-        tolua_faction_set_age);
-      tolua_variable(L, TOLUA_CAST "options", tolua_faction_get_options,
-        tolua_faction_set_options);
-      tolua_variable(L, TOLUA_CAST "flags", tolua_faction_get_flags, tolua_faction_set_flags);
-      tolua_variable(L, TOLUA_CAST "lastturn", tolua_faction_get_lastturn,
-        tolua_faction_set_lastturn);
+            tolua_variable(L, TOLUA_CAST "maxheroes", tolua_faction_get_maxheroes,
+                NULL);
+            tolua_variable(L, TOLUA_CAST "password", tolua_faction_get_password,
+                tolua_faction_set_password);
+            tolua_variable(L, TOLUA_CAST "email", tolua_faction_get_email,
+                tolua_faction_set_email);
+            tolua_variable(L, TOLUA_CAST "locale", tolua_faction_get_locale,
+                tolua_faction_set_locale);
+            tolua_variable(L, TOLUA_CAST "race", tolua_faction_get_race,
+                tolua_faction_set_race);
+            tolua_variable(L, TOLUA_CAST "alliance", tolua_faction_get_alliance,
+                tolua_faction_set_alliance);
+            tolua_variable(L, TOLUA_CAST "score", tolua_faction_get_score, NULL);
+            tolua_variable(L, TOLUA_CAST "magic", &tolua_faction_get_magic,
+                tolua_faction_set_magic);
+            tolua_variable(L, TOLUA_CAST "age", tolua_faction_get_age,
+                tolua_faction_set_age);
+            tolua_variable(L, TOLUA_CAST "options", tolua_faction_get_options,
+                tolua_faction_set_options);
+            tolua_variable(L, TOLUA_CAST "flags", tolua_faction_get_flags, tolua_faction_set_flags);
+            tolua_variable(L, TOLUA_CAST "lastturn", tolua_faction_get_lastturn,
+                tolua_faction_set_lastturn);
 
-      tolua_function(L, TOLUA_CAST "set_policy", &tolua_faction_set_policy);
-      tolua_function(L, TOLUA_CAST "get_policy", &tolua_faction_get_policy);
-      tolua_function(L, TOLUA_CAST "get_origin", &tolua_faction_get_origin);
-      tolua_function(L, TOLUA_CAST "set_origin", &tolua_faction_set_origin);
-      tolua_function(L, TOLUA_CAST "normalize", &tolua_faction_normalize);
+            tolua_function(L, TOLUA_CAST "set_policy", &tolua_faction_set_policy);
+            tolua_function(L, TOLUA_CAST "get_policy", &tolua_faction_get_policy);
+            tolua_function(L, TOLUA_CAST "get_origin", &tolua_faction_get_origin);
+            tolua_function(L, TOLUA_CAST "set_origin", &tolua_faction_set_origin);
+            tolua_function(L, TOLUA_CAST "normalize", &tolua_faction_normalize);
 
-      tolua_function(L, TOLUA_CAST "add_item", tolua_faction_add_item);
-      tolua_variable(L, TOLUA_CAST "items", tolua_faction_get_items, NULL);
+            tolua_function(L, TOLUA_CAST "add_item", tolua_faction_add_item);
+            tolua_variable(L, TOLUA_CAST "items", tolua_faction_get_items, NULL);
 
-      tolua_function(L, TOLUA_CAST "renumber", tolua_faction_renumber);
-      tolua_function(L, TOLUA_CAST "create", tolua_faction_create);
-      tolua_function(L, TOLUA_CAST "get", tolua_faction_get);
-      tolua_function(L, TOLUA_CAST "destroy", tolua_faction_destroy);
-      tolua_function(L, TOLUA_CAST "add_notice", &tolua_faction_addnotice);
+            tolua_function(L, TOLUA_CAST "renumber", tolua_faction_renumber);
+            tolua_function(L, TOLUA_CAST "create", tolua_faction_create);
+            tolua_function(L, TOLUA_CAST "get", tolua_faction_get);
+            tolua_function(L, TOLUA_CAST "destroy", tolua_faction_destroy);
+            tolua_function(L, TOLUA_CAST "add_notice", &tolua_faction_addnotice);
 
-      tolua_variable(L, TOLUA_CAST "objects", tolua_faction_get_objects,
-        NULL);
+            tolua_variable(L, TOLUA_CAST "objects", tolua_faction_get_objects,
+                NULL);
+        }
+        tolua_endmodule(L);
     }
     tolua_endmodule(L);
-  }
-  tolua_endmodule(L);
 }
diff --git a/src/bind_faction.h b/src/bind_faction.h
index c390c5606..2de048803 100644
--- a/src/bind_faction.h
+++ b/src/bind_faction.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
 +-------------------+
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Christian Schlittchen <corwin@amber.kn-bremen.de>
diff --git a/src/bind_gmtool.c b/src/bind_gmtool.c
index 76d85281f..3a07cfc6b 100644
--- a/src/bind_gmtool.c
+++ b/src/bind_gmtool.c
@@ -16,143 +16,145 @@
 
 static int tolua_run_mapper(lua_State * L)
 {
-  run_mapper();
-  return 0;
+    run_mapper();
+    return 0;
 }
 
 static int tolua_highlight_region(lua_State * L)
 {
-  region *r = (region *)tolua_tousertype(L, 1, 0);
-  int select = tolua_toboolean(L, 2, 0);
-  highlight_region(r, select);
-  return 0;
+    region *r = (region *)tolua_tousertype(L, 1, 0);
+    int select = tolua_toboolean(L, 2, 0);
+    highlight_region(r, select);
+    return 0;
 }
 
 static int tolua_current_region(lua_State * L)
 {
-  map_region *mr =
-    cursor_region(&current_state->display, &current_state->cursor);
-  tolua_pushusertype(L, mr ? mr->r : NULL, TOLUA_CAST "region");
-  return 1;
+    map_region *mr =
+        cursor_region(&current_state->display, &current_state->cursor);
+    tolua_pushusertype(L, mr ? mr->r : NULL, TOLUA_CAST "region");
+    return 1;
 }
 
 static int tolua_select_coordinate(lua_State * L)
 {
-  int nx = (int)tolua_tonumber(L, 1, 0);
-  int ny = (int)tolua_tonumber(L, 2, 0);
-  int select = tolua_toboolean(L, 3, 0);
-  if (current_state) {
-    select_coordinate(current_state->selected, nx, ny, select);
-  }
-  return 0;
+    int nx = (int)tolua_tonumber(L, 1, 0);
+    int ny = (int)tolua_tonumber(L, 2, 0);
+    int select = tolua_toboolean(L, 3, 0);
+    if (current_state) {
+        select_coordinate(current_state->selected, nx, ny, select);
+    }
+    return 0;
 }
 
 static int tolua_select_region(lua_State * L)
 {
-  region *r = tolua_tousertype(L, 1, 0);
-  int select = tolua_toboolean(L, 2, 0);
-  if (current_state && r) {
-    select_coordinate(current_state->selected, r->x, r->y, select);
-  }
-  return 0;
+    region *r = tolua_tousertype(L, 1, 0);
+    int select = tolua_toboolean(L, 2, 0);
+    if (current_state && r) {
+        select_coordinate(current_state->selected, r->x, r->y, select);
+    }
+    return 0;
 }
 
 typedef struct tag_iterator {
-  selection *list;
-  tag *node;
-  region *r;
-  int hash;
+    selection *list;
+    tag *node;
+    region *r;
+    int hash;
 } tag_iterator;
 
 void tag_advance(tag_iterator * iter)
 {
-  while (iter->hash != MAXTHASH) {
-    if (iter->node) {
-      iter->node = iter->node->nexthash;
+    while (iter->hash != MAXTHASH) {
+        if (iter->node) {
+            iter->node = iter->node->nexthash;
+        }
+        while (!iter->node && iter->hash != MAXTHASH) {
+            if (++iter->hash != MAXTHASH) {
+                iter->node = iter->list->tags[iter->hash];
+            }
+        }
+        if (iter->node) {
+            iter->r = findregion(iter->node->coord.x, iter->node->coord.y);
+            if (iter->r) {
+                break;
+            }
+        }
     }
-    while (!iter->node && iter->hash != MAXTHASH) {
-      if (++iter->hash != MAXTHASH) {
-        iter->node = iter->list->tags[iter->hash];
-      }
-    }
-    if (iter->node) {
-      iter->r = findregion(iter->node->coord.x, iter->node->coord.y);
-      if (iter->r) {
-        break;
-      }
-    }
-  }
 }
 
 void tag_rewind(tag_iterator * iter)
 {
-  if (iter->list) {
-    iter->r = NULL;
-    iter->node = iter->list->tags[0];
-    iter->hash = 0;
-    if (iter->node) {
-      iter->r = findregion(iter->node->coord.x, iter->node->coord.y);
+    if (iter->list) {
+        iter->r = NULL;
+        iter->node = iter->list->tags[0];
+        iter->hash = 0;
+        if (iter->node) {
+            iter->r = findregion(iter->node->coord.x, iter->node->coord.y);
+        }
+        if (!iter->r) {
+            tag_advance(iter);
+        }
     }
-    if (!iter->r) {
-      tag_advance(iter);
+    else {
+        iter->node = 0;
+        iter->hash = MAXTHASH;
     }
-  } else {
-    iter->node = 0;
-    iter->hash = MAXTHASH;
-  }
 }
 
 static int tolua_tags_next(lua_State * L)
 {
-  tag_iterator *iter = (tag_iterator *) lua_touserdata(L, lua_upvalueindex(1));
-  if (iter->node) {
-    tolua_pushusertype(L, (void *)iter->r, TOLUA_CAST "region");
-    tag_advance(iter);
-    return 1;
-  } else {
-    return 0;                   /* no more values to return */
-  }
+    tag_iterator *iter = (tag_iterator *)lua_touserdata(L, lua_upvalueindex(1));
+    if (iter->node) {
+        tolua_pushusertype(L, (void *)iter->r, TOLUA_CAST "region");
+        tag_advance(iter);
+        return 1;
+    }
+    else {
+        return 0;                   /* no more values to return */
+    }
 }
 
 static int tolua_selected_regions(lua_State * L)
 {
-  tag_iterator *iter =
-    (tag_iterator *) lua_newuserdata(L, sizeof(tag_iterator));
+    tag_iterator *iter =
+        (tag_iterator *)lua_newuserdata(L, sizeof(tag_iterator));
 
-  luaL_getmetatable(L, "tag_iterator");
-  lua_setmetatable(L, -2);
+    luaL_getmetatable(L, "tag_iterator");
+    lua_setmetatable(L, -2);
 
-  iter->list = current_state->selected;
-  tag_rewind(iter);
+    iter->list = current_state->selected;
+    tag_rewind(iter);
 
-  lua_pushcclosure(L, tolua_tags_next, 1);
-  return 1;
+    lua_pushcclosure(L, tolua_tags_next, 1);
+    return 1;
 }
 
 static int tolua_state_open(lua_State * L)
 {
-  unused_arg(L);
-  state_open();
-  return 0;
+    unused_arg(L);
+    state_open();
+    return 0;
 }
 
 static int tolua_state_close(lua_State * L)
 {
-  unused_arg(L);
-  state_close(current_state);
-  return 0;
+    unused_arg(L);
+    state_close(current_state);
+    return 0;
 }
 
 static int tolua_make_island(lua_State * L)
 {
-  int x = (int)tolua_tonumber(L, 1, 0);
-  int y = (int)tolua_tonumber(L, 2, 0);
-  int s = (int)tolua_tonumber(L, 3, 0);
-  int n = (int)tolua_tonumber(L, 4, s / 3);
+    int x = (int)tolua_tonumber(L, 1, 0);
+    int y = (int)tolua_tonumber(L, 2, 0);
+    int s = (int)tolua_tonumber(L, 3, 0);
+    int n = (int)tolua_tonumber(L, 4, s / 3);
 
-  n = build_island_e3(x, y, n, s);
-  tolua_pushnumber(L, n);
-  return 1;
+    n = build_island_e3(x, y, n, s);
+    tolua_pushnumber(L, n);
+    return 1;
 }
 
 static int paint_handle;
@@ -160,93 +162,95 @@ static struct lua_State *paint_state;
 
 static void lua_paint_info(struct window *wnd, const struct state *st)
 {
-  struct lua_State *L = paint_state;
-  int nx = st->cursor.x, ny = st->cursor.y;
-  pnormalize(&nx, &ny, st->cursor.pl);
-  lua_rawgeti(L, LUA_REGISTRYINDEX, paint_handle);
-  tolua_pushnumber(L, nx);
-  tolua_pushnumber(L, ny);
-  if (lua_pcall(L, 2, 1, 0) != 0) {
-    const char *error = lua_tostring(L, -1);
-    log_error("paint function failed: %s\n", error);
-    lua_pop(L, 1);
-    tolua_error(L, TOLUA_CAST "event handler call failed", NULL);
-  } else {
-    const char *result = lua_tostring(L, -1);
-    WINDOW *win = wnd->handle;
-    int size = getmaxx(win) - 2;
-    int line = 0, maxline = getmaxy(win) - 2;
-    const char *str = result;
-    wxborder(win);
-
-    while (*str && line < maxline) {
-      const char *end = strchr(str, '\n');
-      if (!end)
-        break;
-      else {
-        size_t len = end - str;
-        int bytes = _min((int)len, size);
-        mvwaddnstr(win, line++, 1, str, bytes);
-        wclrtoeol(win);
-        str = end + 1;
-      }
+    struct lua_State *L = paint_state;
+    int nx = st->cursor.x, ny = st->cursor.y;
+    pnormalize(&nx, &ny, st->cursor.pl);
+    lua_rawgeti(L, LUA_REGISTRYINDEX, paint_handle);
+    tolua_pushnumber(L, nx);
+    tolua_pushnumber(L, ny);
+    if (lua_pcall(L, 2, 1, 0) != 0) {
+        const char *error = lua_tostring(L, -1);
+        log_error("paint function failed: %s\n", error);
+        lua_pop(L, 1);
+        tolua_error(L, TOLUA_CAST "event handler call failed", NULL);
+    }
+    else {
+        const char *result = lua_tostring(L, -1);
+        WINDOW *win = wnd->handle;
+        int size = getmaxx(win) - 2;
+        int line = 0, maxline = getmaxy(win) - 2;
+        const char *str = result;
+        wxborder(win);
+
+        while (*str && line < maxline) {
+            const char *end = strchr(str, '\n');
+            if (!end)
+                break;
+            else {
+                size_t len = end - str;
+                int bytes = _min((int)len, size);
+                mvwaddnstr(win, line++, 1, str, bytes);
+                wclrtoeol(win);
+                str = end + 1;
+            }
+        }
     }
-  }
 }
 
 static int tolua_set_display(lua_State * L)
 {
-  int type = lua_type(L, 1);
-  if (type == LUA_TFUNCTION) {
-    lua_pushvalue(L, 1);
-    paint_handle = luaL_ref(L, LUA_REGISTRYINDEX);
-    paint_state = L;
+    int type = lua_type(L, 1);
+    if (type == LUA_TFUNCTION) {
+        lua_pushvalue(L, 1);
+        paint_handle = luaL_ref(L, LUA_REGISTRYINDEX);
+        paint_state = L;
 
-    set_info_function(&lua_paint_info);
-  } else {
-    set_info_function(NULL);
-  }
-  return 0;
+        set_info_function(&lua_paint_info);
+    }
+    else {
+        set_info_function(NULL);
+    }
+    return 0;
 }
 
 static int tolua_make_block(lua_State * L)
 {
-  int x = (int)tolua_tonumber(L, 1, 0);
-  int y = (int)tolua_tonumber(L, 2, 0);
-  int r = (int)tolua_tonumber(L, 3, 6);
-  const char *str = tolua_tostring(L, 4, TOLUA_CAST "ocean");
-  const struct terrain_type *ter = get_terrain(str);
+    int x = (int)tolua_tonumber(L, 1, 0);
+    int y = (int)tolua_tonumber(L, 2, 0);
+    int r = (int)tolua_tonumber(L, 3, 6);
+    const char *str = tolua_tostring(L, 4, TOLUA_CAST "ocean");
+    const struct terrain_type *ter = get_terrain(str);
 
-  make_block(x, y, r, ter);
-  return 0;
+    make_block(x, y, r, ter);
+    return 0;
 }
 
 void tolua_gmtool_open(lua_State * L)
 {
-  /* register user types */
-  tolua_usertype(L, TOLUA_CAST "tag_iterator");
+    /* register user types */
+    tolua_usertype(L, TOLUA_CAST "tag_iterator");
 
-  tolua_module(L, NULL, 0);
-  tolua_beginmodule(L, NULL);
-  {
-    tolua_module(L, TOLUA_CAST "gmtool", 0);
-    tolua_beginmodule(L, TOLUA_CAST "gmtool");
+    tolua_module(L, NULL, 0);
+    tolua_beginmodule(L, NULL);
     {
-      tolua_function(L, TOLUA_CAST "open", &tolua_state_open);
-      tolua_function(L, TOLUA_CAST "close", &tolua_state_close);
+        tolua_module(L, TOLUA_CAST "gmtool", 0);
+        tolua_beginmodule(L, TOLUA_CAST "gmtool");
+        {
+            tolua_function(L, TOLUA_CAST "open", &tolua_state_open);
+            tolua_function(L, TOLUA_CAST "close", &tolua_state_close);
 
-      tolua_function(L, TOLUA_CAST "editor", &tolua_run_mapper);
-      tolua_function(L, TOLUA_CAST "get_selection", &tolua_selected_regions);
-      tolua_function(L, TOLUA_CAST "get_cursor", &tolua_current_region);
-      tolua_function(L, TOLUA_CAST "highlight", &tolua_highlight_region);
-      tolua_function(L, TOLUA_CAST "select", &tolua_select_region);
-      tolua_function(L, TOLUA_CAST "select_at", &tolua_select_coordinate);
-      tolua_function(L, TOLUA_CAST "set_display", &tolua_set_display);
+            tolua_function(L, TOLUA_CAST "editor", &tolua_run_mapper);
+            tolua_function(L, TOLUA_CAST "get_selection", &tolua_selected_regions);
+            tolua_function(L, TOLUA_CAST "get_cursor", &tolua_current_region);
+            tolua_function(L, TOLUA_CAST "highlight", &tolua_highlight_region);
+            tolua_function(L, TOLUA_CAST "select", &tolua_select_region);
+            tolua_function(L, TOLUA_CAST "select_at", &tolua_select_coordinate);
+            tolua_function(L, TOLUA_CAST "set_display", &tolua_set_display);
 
-      tolua_function(L, TOLUA_CAST "make_block", &tolua_make_block);
-      tolua_function(L, TOLUA_CAST "make_island", &tolua_make_island);
+            tolua_function(L, TOLUA_CAST "make_block", &tolua_make_block);
+            tolua_function(L, TOLUA_CAST "make_island", &tolua_make_island);
+        }
+        tolua_endmodule(L);
     }
     tolua_endmodule(L);
-  }
-  tolua_endmodule(L);
 }
diff --git a/src/bind_message.c b/src/bind_message.c
index 07fb471dc..24439804d 100644
--- a/src/bind_message.c
+++ b/src/bind_message.c
@@ -27,310 +27,313 @@
 #define E_INVALID_PARAMETER_VALUE 4
 
 typedef struct lua_message {
-  const message_type *mtype;
-  message *msg;
-  variant *args;
+    const message_type *mtype;
+    message *msg;
+    variant *args;
 } lua_message;
 
 int mtype_get_param(const message_type * mtype, const char *param)
 {
-  int i;
-  for (i = 0; i != mtype->nparameters; ++i) {
-    if (strcmp(mtype->pnames[i], param) == 0) {
-      return i;
+    int i;
+    for (i = 0; i != mtype->nparameters; ++i) {
+        if (strcmp(mtype->pnames[i], param) == 0) {
+            return i;
+        }
     }
-  }
-  return mtype->nparameters;
+    return mtype->nparameters;
 }
 
 static lua_message *msg_create_message(const char *type)
 {
-  lua_message *lmsg = malloc(sizeof(lua_message));
-  lmsg->msg = 0;
-  lmsg->args = 0;
-  lmsg->mtype = mt_find(type);
-  if (lmsg->mtype) {
-    lmsg->args = (variant *) calloc(lmsg->mtype->nparameters, sizeof(variant));
-  }
-  return lmsg;
+    lua_message *lmsg = malloc(sizeof(lua_message));
+    lmsg->msg = 0;
+    lmsg->args = 0;
+    lmsg->mtype = mt_find(type);
+    if (lmsg->mtype) {
+        lmsg->args = (variant *)calloc(lmsg->mtype->nparameters, sizeof(variant));
+    }
+    return lmsg;
 }
 
 /*
  static void
-msg_destroy_message(lua_message * msg)
-{
-  if (msg->msg) msg_release(msg->msg);
-  if (msg->mtype) {
-    int i;
-    for (i=0;i!=msg->mtype->nparameters;++i) {
-      if (msg->mtype->types[i]->release) {
-        msg->mtype->types[i]->release(msg->args[i]);
-      }
-    }
-  }
-}
-*/
+ msg_destroy_message(lua_message * msg)
+ {
+ if (msg->msg) msg_release(msg->msg);
+ if (msg->mtype) {
+ int i;
+ for (i=0;i!=msg->mtype->nparameters;++i) {
+ if (msg->mtype->types[i]->release) {
+ msg->mtype->types[i]->release(msg->args[i]);
+ }
+ }
+ }
+ }
+ */
 int msg_set_resource(lua_message * msg, const char *param, const char *resname)
 {
-  if (msg->mtype) {
-    int i = mtype_get_param(msg->mtype, param);
-    const resource_type * rtype;
-    if (i == msg->mtype->nparameters) {
-      return E_INVALID_PARAMETER_NAME;
-    }
-    if (strcmp(msg->mtype->types[i]->name, "resource") != 0) {
-      return E_INVALID_PARAMETER_TYPE;
-    }
+    if (msg->mtype) {
+        int i = mtype_get_param(msg->mtype, param);
+        const resource_type * rtype;
+        if (i == msg->mtype->nparameters) {
+            return E_INVALID_PARAMETER_NAME;
+        }
+        if (strcmp(msg->mtype->types[i]->name, "resource") != 0) {
+            return E_INVALID_PARAMETER_TYPE;
+        }
 
-    rtype = rt_find(resname);
-    if (rtype) {
-      msg->args[i].v = (void *)rtype;
-    } else {
-      return E_INVALID_PARAMETER_VALUE;
+        rtype = rt_find(resname);
+        if (rtype) {
+            msg->args[i].v = (void *)rtype;
+        }
+        else {
+            return E_INVALID_PARAMETER_VALUE;
+        }
+        return E_OK;
     }
-    return E_OK;
-  }
-  return E_INVALID_MESSAGE;
+    return E_INVALID_MESSAGE;
 }
 
 int msg_set_unit(lua_message * msg, const char *param, const unit * u)
 {
-  if (msg->mtype) {
-    int i = mtype_get_param(msg->mtype, param);
+    if (msg->mtype) {
+        int i = mtype_get_param(msg->mtype, param);
 
-    if (i == msg->mtype->nparameters) {
-      return E_INVALID_PARAMETER_NAME;
+        if (i == msg->mtype->nparameters) {
+            return E_INVALID_PARAMETER_NAME;
+        }
+        if (strcmp(msg->mtype->types[i]->name, "unit") != 0) {
+            return E_INVALID_PARAMETER_TYPE;
+        }
+
+        msg->args[i].v = (void *)u;
+
+        return E_OK;
     }
-    if (strcmp(msg->mtype->types[i]->name, "unit") != 0) {
-      return E_INVALID_PARAMETER_TYPE;
-    }
-
-    msg->args[i].v = (void *)u;
-
-    return E_OK;
-  }
-  return E_INVALID_MESSAGE;
+    return E_INVALID_MESSAGE;
 }
 
 int msg_set_region(lua_message * msg, const char *param, const region * r)
 {
-  if (msg->mtype) {
-    int i = mtype_get_param(msg->mtype, param);
+    if (msg->mtype) {
+        int i = mtype_get_param(msg->mtype, param);
 
-    if (i == msg->mtype->nparameters) {
-      return E_INVALID_PARAMETER_NAME;
+        if (i == msg->mtype->nparameters) {
+            return E_INVALID_PARAMETER_NAME;
+        }
+        if (strcmp(msg->mtype->types[i]->name, "region") != 0) {
+            return E_INVALID_PARAMETER_TYPE;
+        }
+
+        msg->args[i].v = (void *)r;
+
+        return E_OK;
     }
-    if (strcmp(msg->mtype->types[i]->name, "region") != 0) {
-      return E_INVALID_PARAMETER_TYPE;
-    }
-
-    msg->args[i].v = (void *)r;
-
-    return E_OK;
-  }
-  return E_INVALID_MESSAGE;
+    return E_INVALID_MESSAGE;
 }
 
 int msg_set_string(lua_message * msg, const char *param, const char *value)
 {
-  if (msg->mtype) {
-    int i = mtype_get_param(msg->mtype, param);
-    variant var;
+    if (msg->mtype) {
+        int i = mtype_get_param(msg->mtype, param);
+        variant var;
 
-    if (i == msg->mtype->nparameters) {
-      return E_INVALID_PARAMETER_NAME;
+        if (i == msg->mtype->nparameters) {
+            return E_INVALID_PARAMETER_NAME;
+        }
+        if (strcmp(msg->mtype->types[i]->name, "string") != 0) {
+            return E_INVALID_PARAMETER_TYPE;
+        }
+
+        var.v = (void *)value;
+        msg->args[i] = msg->mtype->types[i]->copy(var);
+
+        return E_OK;
     }
-    if (strcmp(msg->mtype->types[i]->name, "string") != 0) {
-      return E_INVALID_PARAMETER_TYPE;
-    }
-
-    var.v = (void *)value;
-    msg->args[i] = msg->mtype->types[i]->copy(var);
-
-    return E_OK;
-  }
-  return E_INVALID_MESSAGE;
+    return E_INVALID_MESSAGE;
 }
 
 int msg_set_int(lua_message * msg, const char *param, int value)
 {
-  if (msg->mtype) {
-    int i = mtype_get_param(msg->mtype, param);
-    if (i == msg->mtype->nparameters) {
-      return E_INVALID_PARAMETER_NAME;
-    }
-    if (strcmp(msg->mtype->types[i]->name, "int") != 0) {
-      return E_INVALID_PARAMETER_TYPE;
-    }
+    if (msg->mtype) {
+        int i = mtype_get_param(msg->mtype, param);
+        if (i == msg->mtype->nparameters) {
+            return E_INVALID_PARAMETER_NAME;
+        }
+        if (strcmp(msg->mtype->types[i]->name, "int") != 0) {
+            return E_INVALID_PARAMETER_TYPE;
+        }
 
-    msg->args[i].i = value;
+        msg->args[i].i = value;
 
-    return E_OK;
-  }
-  return E_INVALID_MESSAGE;
+        return E_OK;
+    }
+    return E_INVALID_MESSAGE;
 }
 
 int msg_send_faction(lua_message * msg, faction * f)
 {
-  assert(f);
-  assert(msg);
+    assert(f);
+    assert(msg);
 
-  if (msg->mtype) {
-    if (msg->msg == NULL) {
-      msg->msg = msg_create(msg->mtype, msg->args);
+    if (msg->mtype) {
+        if (msg->msg == NULL) {
+            msg->msg = msg_create(msg->mtype, msg->args);
+        }
+        add_message(&f->msgs, msg->msg);
+        return E_OK;
     }
-    add_message(&f->msgs, msg->msg);
-    return E_OK;
-  }
-  return E_INVALID_MESSAGE;
+    return E_INVALID_MESSAGE;
 }
 
 int msg_send_region(lua_message * lmsg, region * r)
 {
-  if (lmsg->mtype) {
-    if (lmsg->msg == NULL) {
-      lmsg->msg = msg_create(lmsg->mtype, lmsg->args);
+    if (lmsg->mtype) {
+        if (lmsg->msg == NULL) {
+            lmsg->msg = msg_create(lmsg->mtype, lmsg->args);
+        }
+        add_message(&r->msgs, lmsg->msg);
+        return E_OK;
     }
-    add_message(&r->msgs, lmsg->msg);
-    return E_OK;
-  }
-  return E_INVALID_MESSAGE;
+    return E_INVALID_MESSAGE;
 }
 
 static int tolua_msg_create(lua_State * L)
 {
-  const char *type = tolua_tostring(L, 1, 0);
-  lua_message *lmsg = msg_create_message(type);
-  tolua_pushusertype(L, (void *)lmsg, TOLUA_CAST "message");
-  return 1;
+    const char *type = tolua_tostring(L, 1, 0);
+    lua_message *lmsg = msg_create_message(type);
+    tolua_pushusertype(L, (void *)lmsg, TOLUA_CAST "message");
+    return 1;
 }
 
 static int tolua_msg_set_string(lua_State * L)
 {
-  lua_message *lmsg = (lua_message *) tolua_tousertype(L, 1, 0);
-  const char *param = tolua_tostring(L, 2, 0);
-  const char *value = tolua_tostring(L, 3, 0);
-  int result = msg_set_string(lmsg, param, value);
-  tolua_pushnumber(L, (lua_Number) result);
-  return 1;
+    lua_message *lmsg = (lua_message *)tolua_tousertype(L, 1, 0);
+    const char *param = tolua_tostring(L, 2, 0);
+    const char *value = tolua_tostring(L, 3, 0);
+    int result = msg_set_string(lmsg, param, value);
+    tolua_pushnumber(L, (lua_Number)result);
+    return 1;
 }
 
 static int tolua_msg_set_int(lua_State * L)
 {
-  lua_message *lmsg = (lua_message *) tolua_tousertype(L, 1, 0);
-  const char *param = tolua_tostring(L, 2, 0);
-  int value = (int)tolua_tonumber(L, 3, 0);
-  int result = msg_set_int(lmsg, param, value);
-  tolua_pushnumber(L, (lua_Number) result);
-  return 1;
+    lua_message *lmsg = (lua_message *)tolua_tousertype(L, 1, 0);
+    const char *param = tolua_tostring(L, 2, 0);
+    int value = (int)tolua_tonumber(L, 3, 0);
+    int result = msg_set_int(lmsg, param, value);
+    tolua_pushnumber(L, (lua_Number)result);
+    return 1;
 }
 
 static int tolua_msg_set_resource(lua_State * L)
 {
-  lua_message *lmsg = (lua_message *) tolua_tousertype(L, 1, 0);
-  const char *param = tolua_tostring(L, 2, 0);
-  const char *value = tolua_tostring(L, 3, 0);
-  int result = msg_set_resource(lmsg, param, value);
-  tolua_pushnumber(L, (lua_Number) result);
-  return 1;
+    lua_message *lmsg = (lua_message *)tolua_tousertype(L, 1, 0);
+    const char *param = tolua_tostring(L, 2, 0);
+    const char *value = tolua_tostring(L, 3, 0);
+    int result = msg_set_resource(lmsg, param, value);
+    tolua_pushnumber(L, (lua_Number)result);
+    return 1;
 }
 
 static int tolua_msg_set_unit(lua_State * L)
 {
-  lua_message *lmsg = (lua_message *) tolua_tousertype(L, 1, 0);
-  const char *param = tolua_tostring(L, 2, 0);
-  unit *value = (unit *) tolua_tousertype(L, 3, 0);
-  int result = msg_set_unit(lmsg, param, value);
-  tolua_pushnumber(L, (lua_Number) result);
-  return 1;
+    lua_message *lmsg = (lua_message *)tolua_tousertype(L, 1, 0);
+    const char *param = tolua_tostring(L, 2, 0);
+    unit *value = (unit *)tolua_tousertype(L, 3, 0);
+    int result = msg_set_unit(lmsg, param, value);
+    tolua_pushnumber(L, (lua_Number)result);
+    return 1;
 }
 
 static int tolua_msg_set_region(lua_State * L)
 {
-  lua_message *lmsg = (lua_message *) tolua_tousertype(L, 1, 0);
-  const char *param = tolua_tostring(L, 2, 0);
-  region *value = (region *) tolua_tousertype(L, 3, 0);
-  int result = msg_set_region(lmsg, param, value);
-  tolua_pushnumber(L, (lua_Number) result);
-  return 1;
+    lua_message *lmsg = (lua_message *)tolua_tousertype(L, 1, 0);
+    const char *param = tolua_tostring(L, 2, 0);
+    region *value = (region *)tolua_tousertype(L, 3, 0);
+    int result = msg_set_region(lmsg, param, value);
+    tolua_pushnumber(L, (lua_Number)result);
+    return 1;
 }
 
 static int tolua_msg_set(lua_State * L)
 {
-  tolua_Error err;
-  if (tolua_isnumber(L, 3, 0, &err)) {
-    return tolua_msg_set_int(L);
-  } else if (tolua_isusertype(L, 3, TOLUA_CAST "region", 0, &err)) {
-    return tolua_msg_set_region(L);
-  } else if (tolua_isusertype(L, 3, TOLUA_CAST "unit", 0, &err)) {
-    return tolua_msg_set_unit(L);
-  }
-  tolua_pushnumber(L, (lua_Number) - 1);
-  return 1;
+    tolua_Error err;
+    if (tolua_isnumber(L, 3, 0, &err)) {
+        return tolua_msg_set_int(L);
+    }
+    else if (tolua_isusertype(L, 3, TOLUA_CAST "region", 0, &err)) {
+        return tolua_msg_set_region(L);
+    }
+    else if (tolua_isusertype(L, 3, TOLUA_CAST "unit", 0, &err)) {
+        return tolua_msg_set_unit(L);
+    }
+    tolua_pushnumber(L, (lua_Number)-1);
+    return 1;
 }
 
 static int tolua_msg_send_region(lua_State * L)
 {
-  lua_message *lmsg = (lua_message *) tolua_tousertype(L, 1, 0);
-  region *r = (region *) tolua_tousertype(L, 2, 0);
-  int result = msg_send_region(lmsg, r);
-  tolua_pushnumber(L, (lua_Number) result);
-  return 1;
+    lua_message *lmsg = (lua_message *)tolua_tousertype(L, 1, 0);
+    region *r = (region *)tolua_tousertype(L, 2, 0);
+    int result = msg_send_region(lmsg, r);
+    tolua_pushnumber(L, (lua_Number)result);
+    return 1;
 }
 
 static int tolua_msg_report_action(lua_State * L)
 {
-  lua_message *lmsg = (lua_message *) tolua_tousertype(L, 1, 0);
-  region *r = (region *) tolua_tousertype(L, 2, 0);
-  unit *u = (unit *) tolua_tousertype(L, 3, 0);
-  int result, flags = (int)tolua_tonumber(L, 4, 0);
-  if (lmsg->msg == NULL) {
-    lmsg->msg = msg_create(lmsg->mtype, lmsg->args);
-  }
-  result = report_action(r, u, lmsg->msg, flags);
-  tolua_pushnumber(L, (lua_Number) result);
-  return 1;
+    lua_message *lmsg = (lua_message *)tolua_tousertype(L, 1, 0);
+    region *r = (region *)tolua_tousertype(L, 2, 0);
+    unit *u = (unit *)tolua_tousertype(L, 3, 0);
+    int result, flags = (int)tolua_tonumber(L, 4, 0);
+    if (lmsg->msg == NULL) {
+        lmsg->msg = msg_create(lmsg->mtype, lmsg->args);
+    }
+    result = report_action(r, u, lmsg->msg, flags);
+    tolua_pushnumber(L, (lua_Number)result);
+    return 1;
 }
 
 static int tolua_msg_send_faction(lua_State * L)
 {
-  lua_message *lmsg = (lua_message *) tolua_tousertype(L, 1, 0);
-  faction *f = (faction *) tolua_tousertype(L, 2, 0);
-  if (f && lmsg) {
-    int result = msg_send_faction(lmsg, f);
-    tolua_pushnumber(L, (lua_Number) result);
-    return 1;
-  }
-  return 0;
+    lua_message *lmsg = (lua_message *)tolua_tousertype(L, 1, 0);
+    faction *f = (faction *)tolua_tousertype(L, 2, 0);
+    if (f && lmsg) {
+        int result = msg_send_faction(lmsg, f);
+        tolua_pushnumber(L, (lua_Number)result);
+        return 1;
+    }
+    return 0;
 }
 
 void tolua_message_open(lua_State * L)
 {
-  /* register user types */
-  tolua_usertype(L, TOLUA_CAST "message");
+    /* register user types */
+    tolua_usertype(L, TOLUA_CAST "message");
 
-  tolua_module(L, NULL, 0);
-  tolua_beginmodule(L, NULL);
-  {
-    tolua_function(L, TOLUA_CAST "message", tolua_msg_create);
-
-    tolua_cclass(L, TOLUA_CAST "message", TOLUA_CAST "message", TOLUA_CAST "",
-      NULL);
-    tolua_beginmodule(L, TOLUA_CAST "message");
+    tolua_module(L, NULL, 0);
+    tolua_beginmodule(L, NULL);
     {
-      tolua_function(L, TOLUA_CAST "set", tolua_msg_set);
-      tolua_function(L, TOLUA_CAST "set_unit", tolua_msg_set_unit);
-      tolua_function(L, TOLUA_CAST "set_region", tolua_msg_set_region);
-      tolua_function(L, TOLUA_CAST "set_resource", tolua_msg_set_resource);
-      tolua_function(L, TOLUA_CAST "set_int", tolua_msg_set_int);
-      tolua_function(L, TOLUA_CAST "set_string", tolua_msg_set_string);
-      tolua_function(L, TOLUA_CAST "send_faction", tolua_msg_send_faction);
-      tolua_function(L, TOLUA_CAST "send_region", tolua_msg_send_region);
-      tolua_function(L, TOLUA_CAST "report_action", tolua_msg_report_action);
+        tolua_function(L, TOLUA_CAST "message", tolua_msg_create);
 
-      tolua_function(L, TOLUA_CAST "create", tolua_msg_create);
+        tolua_cclass(L, TOLUA_CAST "message", TOLUA_CAST "message", TOLUA_CAST "",
+            NULL);
+        tolua_beginmodule(L, TOLUA_CAST "message");
+        {
+            tolua_function(L, TOLUA_CAST "set", tolua_msg_set);
+            tolua_function(L, TOLUA_CAST "set_unit", tolua_msg_set_unit);
+            tolua_function(L, TOLUA_CAST "set_region", tolua_msg_set_region);
+            tolua_function(L, TOLUA_CAST "set_resource", tolua_msg_set_resource);
+            tolua_function(L, TOLUA_CAST "set_int", tolua_msg_set_int);
+            tolua_function(L, TOLUA_CAST "set_string", tolua_msg_set_string);
+            tolua_function(L, TOLUA_CAST "send_faction", tolua_msg_send_faction);
+            tolua_function(L, TOLUA_CAST "send_region", tolua_msg_send_region);
+            tolua_function(L, TOLUA_CAST "report_action", tolua_msg_report_action);
+
+            tolua_function(L, TOLUA_CAST "create", tolua_msg_create);
+        }
+        tolua_endmodule(L);
     }
     tolua_endmodule(L);
-  }
-  tolua_endmodule(L);
 }
diff --git a/src/bind_message.h b/src/bind_message.h
index ed9aab133..9087f63d3 100644
--- a/src/bind_message.h
+++ b/src/bind_message.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
 +-------------------+
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Christian Schlittchen <corwin@amber.kn-bremen.de>
diff --git a/src/bind_monsters.c b/src/bind_monsters.c
index 49b05ccc9..8897da0d1 100644
--- a/src/bind_monsters.c
+++ b/src/bind_monsters.c
@@ -16,13 +16,13 @@
 
 static int tolua_levitate_ship(lua_State * L)
 {
-  ship *sh = (ship *) tolua_tousertype(L, 1, 0);
-  unit *mage = (unit *) tolua_tousertype(L, 2, 0);
-  float power = (float)tolua_tonumber(L, 3, 0);
-  int duration = (int)tolua_tonumber(L, 4, 0);
-  int cno = levitate_ship(sh, mage, power, duration);
-  tolua_pushnumber(L, (lua_Number) cno);
-  return 1;
+    ship *sh = (ship *)tolua_tousertype(L, 1, 0);
+    unit *mage = (unit *)tolua_tousertype(L, 2, 0);
+    float power = (float)tolua_tonumber(L, 3, 0);
+    int duration = (int)tolua_tonumber(L, 4, 0);
+    int cno = levitate_ship(sh, mage, power, duration);
+    tolua_pushnumber(L, (lua_Number)cno);
+    return 1;
 }
 
 extern void spawn_undead(void);
@@ -31,64 +31,64 @@ extern void plan_monsters(struct faction *f);
 
 static int tolua_planmonsters(lua_State * L)
 {
-  faction *f = (faction *) tolua_tousertype(L, 1, get_monsters());
-  if (f) {
-    plan_monsters(f);
-  }
+    faction *f = (faction *)tolua_tousertype(L, 1, get_monsters());
+    if (f) {
+        plan_monsters(f);
+    }
 
-  return 0;
+    return 0;
 }
 
 static int tolua_spawn_dragons(lua_State * L)
 {
-  spawn_dragons();
-  return 0;
+    spawn_dragons();
+    return 0;
 }
 
 static int tolua_spawn_undead(lua_State * L)
 {
-  spawn_undead();
-  return 0;
+    spawn_undead();
+    return 0;
 }
 
 static int fix_familiars(struct lua_State *L)
 {
-  faction *f;
-  for (f = factions; f; f = f->next) {
-    unit *u;
-    for (u = f->units; u; u = u->nextF) {
-      struct sc_mage *mage = get_mage(u);
-      if (mage && is_familiar(u)) {
-        if (mage->spellbook && mage->magietyp == M_GRAY) {
-          equipment *eq;
-          char buffer[64];
+    faction *f;
+    for (f = factions; f; f = f->next) {
+        unit *u;
+        for (u = f->units; u; u = u->nextF) {
+            struct sc_mage *mage = get_mage(u);
+            if (mage && is_familiar(u)) {
+                if (mage->spellbook && mage->magietyp == M_GRAY) {
+                    equipment *eq;
+                    char buffer[64];
 
-          spellbook_clear(mage->spellbook);
-          free(mage->spellbook);
-          mage->spellbook = 0;
+                    spellbook_clear(mage->spellbook);
+                    free(mage->spellbook);
+                    mage->spellbook = 0;
 
-          _snprintf(buffer, sizeof(buffer), "%s_familiar", u_race(u)->_name);
-          eq = get_equipment(buffer);
-          if (eq) {
-            equip_unit_mask(u, eq, EQUIP_SPELLS);
-          }
+                    _snprintf(buffer, sizeof(buffer), "%s_familiar", u_race(u)->_name);
+                    eq = get_equipment(buffer);
+                    if (eq) {
+                        equip_unit_mask(u, eq, EQUIP_SPELLS);
+                    }
+                }
+            }
         }
-      }
     }
-  }
-  return 0;
+    return 0;
 }
 
 void bind_monsters(struct lua_State *L)
 {
-  tolua_module(L, NULL, 0);
-  tolua_beginmodule(L, NULL);
-  {
-    tolua_function(L, TOLUA_CAST "levitate_ship", tolua_levitate_ship);
-    tolua_function(L, TOLUA_CAST "plan_monsters", tolua_planmonsters);
-    tolua_function(L, TOLUA_CAST "spawn_undead", tolua_spawn_undead);
-    tolua_function(L, TOLUA_CAST "spawn_dragons", tolua_spawn_dragons);
-    tolua_function(L, TOLUA_CAST "fix_familiars", &fix_familiars);
-  }
-  tolua_endmodule(L);
+    tolua_module(L, NULL, 0);
+    tolua_beginmodule(L, NULL);
+    {
+        tolua_function(L, TOLUA_CAST "levitate_ship", tolua_levitate_ship);
+        tolua_function(L, TOLUA_CAST "plan_monsters", tolua_planmonsters);
+        tolua_function(L, TOLUA_CAST "spawn_undead", tolua_spawn_undead);
+        tolua_function(L, TOLUA_CAST "spawn_dragons", tolua_spawn_dragons);
+        tolua_function(L, TOLUA_CAST "fix_familiars", &fix_familiars);
+    }
+    tolua_endmodule(L);
 }
diff --git a/src/bind_process.c b/src/bind_process.c
index 2a036e49e..c411e257a 100755
--- a/src/bind_process.c
+++ b/src/bind_process.c
@@ -19,128 +19,129 @@
 #define PROC_LAND_REGION 0x0001
 #define PROC_LONG_ORDER 0x0002
 
-static void process_cmd(keyword_t kwd, int (*callback)(unit *, order *), int flags)
+static void process_cmd(keyword_t kwd, int(*callback)(unit *, order *), int flags)
 {
-  region * r;
-  for (r=regions; r; r=r->next) {
-    unit * u;
+    region * r;
+    for (r = regions; r; r = r->next) {
+        unit * u;
 
-    /* look for shortcuts */
-    if (flags&PROC_LAND_REGION) {
-      /* only execute when we are on solid terrain */
-      while (r && (r->terrain->flags&LAND_REGION)==0) {
-        r = r->next;
-      }
-      if (!r) break;
-    }
+        /* look for shortcuts */
+        if (flags&PROC_LAND_REGION) {
+            /* only execute when we are on solid terrain */
+            while (r && (r->terrain->flags&LAND_REGION) == 0) {
+                r = r->next;
+            }
+            if (!r) break;
+        }
 
-    for (u=r->units; u; u=u->next) {
-      if (flags & PROC_LONG_ORDER) {
-        if (kwd == getkeyword(u->thisorder)) {
-          callback(u, u->thisorder);
+        for (u = r->units; u; u = u->next) {
+            if (flags & PROC_LONG_ORDER) {
+                if (kwd == getkeyword(u->thisorder)) {
+                    callback(u, u->thisorder);
+                }
+            }
+            else {
+                order * ord;
+                for (ord = u->orders; ord; ord = ord->next) {
+                    if (kwd == getkeyword(ord)) {
+                        callback(u, ord);
+                    }
+                }
+            }
         }
-      } else {
-        order * ord;
-        for (ord=u->orders; ord; ord=ord->next) {
-          if (kwd == getkeyword(ord)) {
-            callback(u, ord);
-          }
-        }
-      }
     }
-  }
 }
 
 void process_produce(void) {
-  struct region *r;
-  for (r = regions; r; r = r->next) {
-    unit * u;
-    for (u=r->units; u; u=u->next) {
-      order * ord;
-      for (ord=u->orders; ord; ord=ord->next) {
-        if (K_MAKE == getkeyword(ord)) {
-          make_cmd(u, ord);
+    struct region *r;
+    for (r = regions; r; r = r->next) {
+        unit * u;
+        for (u = r->units; u; u = u->next) {
+            order * ord;
+            for (ord = u->orders; ord; ord = ord->next) {
+                if (K_MAKE == getkeyword(ord)) {
+                    make_cmd(u, ord);
+                }
+            }
         }
-      }
+        produce(r);
+        split_allocations(r);
     }
-    produce(r);
-    split_allocations(r);
-  }
 }
 
 void process_battle(void) {
-  struct region *r;
-  for (r = regions; r; r = r->next) {
-    do_battle(r);
-  }
+    struct region *r;
+    for (r = regions; r; r = r->next) {
+        do_battle(r);
+    }
 }
 
 void process_siege(void) {
-  process_cmd(K_BESIEGE, siege_cmd, PROC_LAND_REGION);
+    process_cmd(K_BESIEGE, siege_cmd, PROC_LAND_REGION);
 }
 
 void process_update_long_order(void) {
-  region * r;
-  for (r=regions; r; r=r->next) {
-    unit * u;
-    for (u=r->units; u; u=u->next) {
-      update_long_order(u);
+    region * r;
+    for (r = regions; r; r = r->next) {
+        unit * u;
+        for (u = r->units; u; u = u->next) {
+            update_long_order(u);
+        }
     }
-  }
 }
 
 void process_markets(void) {
-  do_markets();
+    do_markets();
 }
 
 void process_make_temp(void) {
-  new_units();
+    new_units();
 }
 
 void process_settings(void) {
-  region * r;
-  for (r=regions; r; r=r->next) {
-    unit * u;
-    for (u=r->units; u; u=u->next) {
-      order * ord;
-      for (ord=u->orders; ord; ord=ord->next) {
-        keyword_t kwd = getkeyword(ord);
-        if (kwd==K_BANNER) {
-          banner_cmd(u, ord);
+    region * r;
+    for (r = regions; r; r = r->next) {
+        unit * u;
+        for (u = r->units; u; u = u->next) {
+            order * ord;
+            for (ord = u->orders; ord; ord = ord->next) {
+                keyword_t kwd = getkeyword(ord);
+                if (kwd == K_BANNER) {
+                    banner_cmd(u, ord);
+                }
+                else if (kwd == K_EMAIL) {
+                    email_cmd(u, ord);
+                }
+                else if (kwd == K_SEND) {
+                    send_cmd(u, ord);
+                }
+                else if (kwd == K_PASSWORD) {
+                    password_cmd(u, ord);
+                }
+            }
         }
-        else if (kwd==K_EMAIL) {
-          email_cmd(u, ord);
-        }
-        else if (kwd==K_SEND) {
-          send_cmd(u, ord);
-        }
-        else if (kwd==K_PASSWORD) {
-          password_cmd(u, ord);
-        }
-      }
     }
-  }
 }
 
 void process_ally(void) {
-  process_cmd(K_ALLY, ally_cmd, 0);
+    process_cmd(K_ALLY, ally_cmd, 0);
 }
 
 void process_prefix(void) {
-  process_cmd(K_PREFIX, prefix_cmd, 0);
+    process_cmd(K_PREFIX, prefix_cmd, 0);
 }
 
 void process_setstealth(void) {
-  process_cmd(K_SETSTEALTH, setstealth_cmd, 0);
+    process_cmd(K_SETSTEALTH, setstealth_cmd, 0);
 }
 
 void process_status(void) {
-  process_cmd(K_STATUS, status_cmd, 0);
+    process_cmd(K_STATUS, status_cmd, 0);
 }
 
 void process_name(void) {
-  process_cmd(K_NAME, name_cmd, 0);
-  process_cmd(K_DISPLAY, display_cmd, 0);
+    process_cmd(K_NAME, name_cmd, 0);
+    process_cmd(K_DISPLAY, display_cmd, 0);
 }
 
 void process_group(void) {
diff --git a/src/bind_region.c b/src/bind_region.c
index 7fbfa484d..cfc5d0f72 100644
--- a/src/bind_region.c
+++ b/src/bind_region.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
 +-------------------+
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Christian Schlittchen <corwin@amber.kn-bremen.de>
@@ -47,27 +47,28 @@ without prior permission by the authors of Eressea.
 
 int tolua_regionlist_next(lua_State * L)
 {
-  region **region_ptr = (region **) lua_touserdata(L, lua_upvalueindex(1));
-  region *r = *region_ptr;
-  if (r != NULL) {
-    tolua_pushusertype(L, (void *)r, TOLUA_CAST "region");
-    *region_ptr = r->next;
-    return 1;
-  } else
-    return 0;                   /* no more values to return */
+    region **region_ptr = (region **)lua_touserdata(L, lua_upvalueindex(1));
+    region *r = *region_ptr;
+    if (r != NULL) {
+        tolua_pushusertype(L, (void *)r, TOLUA_CAST "region");
+        *region_ptr = r->next;
+        return 1;
+    }
+    else
+        return 0;                   /* no more values to return */
 }
 
 static int tolua_region_get_id(lua_State * L)
 {
-  region *self = (region *) tolua_tousertype(L, 1, 0);
-  tolua_pushnumber(L, (lua_Number) self->uid);
-  return 1;
+    region *self = (region *)tolua_tousertype(L, 1, 0);
+    tolua_pushnumber(L, (lua_Number)self->uid);
+    return 1;
 }
 
 static int tolua_region_get_blocked(lua_State * L)
 {
     region *self = (region *)tolua_tousertype(L, 1, 0);
-    lua_pushboolean(L, (self->flags&RF_BLOCKED)!=0);
+    lua_pushboolean(L, (self->flags&RF_BLOCKED) != 0);
     return 1;
 }
 
@@ -82,657 +83,663 @@ static int tolua_region_set_blocked(lua_State * L)
 
 static int tolua_region_get_x(lua_State * L)
 {
-  region *self = (region *) tolua_tousertype(L, 1, 0);
-  tolua_pushnumber(L, (lua_Number) self->x);
-  return 1;
+    region *self = (region *)tolua_tousertype(L, 1, 0);
+    tolua_pushnumber(L, (lua_Number)self->x);
+    return 1;
 }
 
 static int tolua_region_get_y(lua_State * L)
 {
-  region *self = (region *) tolua_tousertype(L, 1, 0);
-  tolua_pushnumber(L, (lua_Number) self->y);
-  return 1;
+    region *self = (region *)tolua_tousertype(L, 1, 0);
+    tolua_pushnumber(L, (lua_Number)self->y);
+    return 1;
 }
 
 static int tolua_region_get_plane(lua_State * L)
 {
-  region *r = (region *) tolua_tousertype(L, 1, 0);
-  tolua_pushusertype(L, rplane(r), TOLUA_CAST "plane");
-  return 1;
+    region *r = (region *)tolua_tousertype(L, 1, 0);
+    tolua_pushusertype(L, rplane(r), TOLUA_CAST "plane");
+    return 1;
 }
 
 static int tolua_region_get_terrain(lua_State * L)
 {
-  region *self = (region *) tolua_tousertype(L, 1, 0);
-  tolua_pushstring(L, self->terrain->_name);
-  return 1;
+    region *self = (region *)tolua_tousertype(L, 1, 0);
+    tolua_pushstring(L, self->terrain->_name);
+    return 1;
 }
 
 static int tolua_region_set_terrain(lua_State * L)
 {
-  region *r = (region *) tolua_tousertype(L, 1, 0);
-  const char *tname = tolua_tostring(L, 2, 0);
-  if (tname) {
-    const terrain_type *terrain = get_terrain(tname);
-    if (terrain) {
-      terraform_region(r, terrain);
+    region *r = (region *)tolua_tousertype(L, 1, 0);
+    const char *tname = tolua_tostring(L, 2, 0);
+    if (tname) {
+        const terrain_type *terrain = get_terrain(tname);
+        if (terrain) {
+            terraform_region(r, terrain);
+        }
     }
-  }
-  return 0;
+    return 0;
 }
 
 static int tolua_region_get_terrainname(lua_State * L)
 {
-  region *self = (region *) tolua_tousertype(L, 1, 0);
-  attrib *a = a_find(self->attribs, &at_racename);
-  if (a) {
-    tolua_pushstring(L, get_racename(a));
-    return 1;
-  }
-  return 0;
+    region *self = (region *)tolua_tousertype(L, 1, 0);
+    attrib *a = a_find(self->attribs, &at_racename);
+    if (a) {
+        tolua_pushstring(L, get_racename(a));
+        return 1;
+    }
+    return 0;
 }
 
 static int tolua_region_set_owner(lua_State * L)
 {
-  region *r = (region *) tolua_tousertype(L, 1, 0);
-  struct faction *f = (struct faction *)tolua_tousertype(L, 2, 0);
-  if (r) {
-    region_set_owner(r, f, turn);
-  }
-  return 0;
+    region *r = (region *)tolua_tousertype(L, 1, 0);
+    struct faction *f = (struct faction *)tolua_tousertype(L, 2, 0);
+    if (r) {
+        region_set_owner(r, f, turn);
+    }
+    return 0;
 }
 
 static int tolua_region_get_owner(lua_State * L)
 {
-  region *r = (region *) tolua_tousertype(L, 1, 0);
-  if (r) {
-    struct faction *f = region_get_owner(r);
-    tolua_pushusertype(L, f, TOLUA_CAST "faction");
-    return 1;
-  }
-  return 0;
+    region *r = (region *)tolua_tousertype(L, 1, 0);
+    if (r) {
+        struct faction *f = region_get_owner(r);
+        tolua_pushusertype(L, f, TOLUA_CAST "faction");
+        return 1;
+    }
+    return 0;
 }
 
 static int tolua_region_set_terrainname(lua_State * L)
 {
-  region *self = (region *) tolua_tousertype(L, 1, 0);
-  const char *name = tolua_tostring(L, 2, 0);
-  if (name == NULL) {
-    a_removeall(&self->attribs, &at_racename);
-  } else {
-    set_racename(&self->attribs, name);
-  }
-  return 0;
+    region *self = (region *)tolua_tousertype(L, 1, 0);
+    const char *name = tolua_tostring(L, 2, 0);
+    if (name == NULL) {
+        a_removeall(&self->attribs, &at_racename);
+    }
+    else {
+        set_racename(&self->attribs, name);
+    }
+    return 0;
 }
 
 static int tolua_region_get_info(lua_State * L)
 {
-  region *self = (region *) tolua_tousertype(L, 1, 0);
-  tolua_pushstring(L, region_getinfo(self));
-  return 1;
+    region *self = (region *)tolua_tousertype(L, 1, 0);
+    tolua_pushstring(L, region_getinfo(self));
+    return 1;
 }
 
 static int tolua_region_set_info(lua_State * L)
 {
-  region *self = (region *) tolua_tousertype(L, 1, 0);
-  region_setinfo(self, tolua_tostring(L, 2, 0));
-  return 0;
+    region *self = (region *)tolua_tousertype(L, 1, 0);
+    region_setinfo(self, tolua_tostring(L, 2, 0));
+    return 0;
 }
 
 static int tolua_region_get_name(lua_State * L)
 {
-  region *self = (region *) tolua_tousertype(L, 1, 0);
-  tolua_pushstring(L, region_getname(self));
-  return 1;
+    region *self = (region *)tolua_tousertype(L, 1, 0);
+    tolua_pushstring(L, region_getname(self));
+    return 1;
 }
 
 static int tolua_region_set_name(lua_State * L)
 {
-  region *self = (region *) tolua_tousertype(L, 1, 0);
-  region_setname(self, tolua_tostring(L, 2, 0));
-  return 0;
+    region *self = (region *)tolua_tousertype(L, 1, 0);
+    region_setname(self, tolua_tostring(L, 2, 0));
+    return 0;
 }
 
 static int tolua_region_get_morale(lua_State * L)
 {
-  region *r = (region *) tolua_tousertype(L, 1, 0);
-  tolua_pushnumber(L, region_get_morale(r));
-  return 1;
+    region *r = (region *)tolua_tousertype(L, 1, 0);
+    tolua_pushnumber(L, region_get_morale(r));
+    return 1;
 }
 
 static int tolua_region_set_morale(lua_State * L)
 {
-  region *r = (region *) tolua_tousertype(L, 1, 0);
-  region_set_morale(r, (int)tolua_tonumber(L, 2, 0), turn);
-  return 0;
+    region *r = (region *)tolua_tousertype(L, 1, 0);
+    region_set_morale(r, (int)tolua_tonumber(L, 2, 0), turn);
+    return 0;
 }
 
 static int tolua_region_get_adj(lua_State * L)
 {
-  region *r = (region *) tolua_tousertype(L, 1, 0);
-  region *rn[MAXDIRECTIONS];
-  int d, idx;
-  get_neighbours(r, rn);
+    region *r = (region *)tolua_tousertype(L, 1, 0);
+    region *rn[MAXDIRECTIONS];
+    int d, idx;
+    get_neighbours(r, rn);
 
-  lua_createtable(L, MAXDIRECTIONS, 0);
-  for (d = 0, idx = 0; d != MAXDIRECTIONS; ++d) {
-    if (rn[d]) {
-      tolua_pushusertype(L, rn[d], TOLUA_CAST "region");
-      lua_rawseti(L, -2, ++idx);
+    lua_createtable(L, MAXDIRECTIONS, 0);
+    for (d = 0, idx = 0; d != MAXDIRECTIONS; ++d) {
+        if (rn[d]) {
+            tolua_pushusertype(L, rn[d], TOLUA_CAST "region");
+            lua_rawseti(L, -2, ++idx);
+        }
     }
-  }
-  return 1;
+    return 1;
 }
 
 static int tolua_region_get_luxury(lua_State * L)
 {
-  region *r = (region *) tolua_tousertype(L, 1, 0);
-  if (r->land) {
-    const item_type *lux = r_luxury(r);
-    if (lux) {
-      const char *name = lux->rtype->_name;
-      tolua_pushstring(L, name);
-      return 1;
+    region *r = (region *)tolua_tousertype(L, 1, 0);
+    if (r->land) {
+        const item_type *lux = r_luxury(r);
+        if (lux) {
+            const char *name = lux->rtype->_name;
+            tolua_pushstring(L, name);
+            return 1;
+        }
     }
-  }
-  return 0;
+    return 0;
 }
 
 static int tolua_region_set_luxury(lua_State * L)
 {
-  region *r = (region *) tolua_tousertype(L, 1, 0);
-  const char *name = tolua_tostring(L, 2, 0);
-  if (r->land && name) {
-    const item_type *lux = r_luxury(r);
-    const item_type *itype = it_find(name);
-    if (lux && itype && lux != itype) {
-      r_setdemand(r, lux->rtype->ltype, 1);
-      r_setdemand(r, itype->rtype->ltype, 0);
+    region *r = (region *)tolua_tousertype(L, 1, 0);
+    const char *name = tolua_tostring(L, 2, 0);
+    if (r->land && name) {
+        const item_type *lux = r_luxury(r);
+        const item_type *itype = it_find(name);
+        if (lux && itype && lux != itype) {
+            r_setdemand(r, lux->rtype->ltype, 1);
+            r_setdemand(r, itype->rtype->ltype, 0);
+        }
     }
-  }
-  return 0;
+    return 0;
 }
 
 static int tolua_region_set_herb(lua_State * L)
 {
-  region *r = (region *) tolua_tousertype(L, 1, 0);
-  if (r->land) {
-    const char *name = tolua_tostring(L, 2, 0);
-    const item_type *itype = it_find(name);
-    if (itype && (itype->flags & ITF_HERB)) {
-      r->land->herbtype = itype;
+    region *r = (region *)tolua_tousertype(L, 1, 0);
+    if (r->land) {
+        const char *name = tolua_tostring(L, 2, 0);
+        const item_type *itype = it_find(name);
+        if (itype && (itype->flags & ITF_HERB)) {
+            r->land->herbtype = itype;
+        }
     }
-  }
-  return 0;
+    return 0;
 }
 
 static int tolua_region_get_herb(lua_State * L)
 {
-  region *r = (region *) tolua_tousertype(L, 1, 0);
-  if (r->land && r->land->herbtype) {
-    const char *name = r->land->herbtype->rtype->_name;
-    tolua_pushstring(L, name);
-    return 1;
-  }
-  return 0;
+    region *r = (region *)tolua_tousertype(L, 1, 0);
+    if (r->land && r->land->herbtype) {
+        const char *name = r->land->herbtype->rtype->_name;
+        tolua_pushstring(L, name);
+        return 1;
+    }
+    return 0;
 }
 
 static int tolua_region_get_next(lua_State * L)
 {
-  region *self = (region *) tolua_tousertype(L, 1, 0);
-  direction_t dir = (direction_t) tolua_tonumber(L, 2, 0);
+    region *self = (region *)tolua_tousertype(L, 1, 0);
+    direction_t dir = (direction_t)tolua_tonumber(L, 2, 0);
 
-  if (dir >= 0 && dir < MAXDIRECTIONS) {
-    tolua_pushusertype(L, (void *)r_connect(self, dir), TOLUA_CAST "region");
-    return 1;
-  }
-  return 0;
+    if (dir >= 0 && dir < MAXDIRECTIONS) {
+        tolua_pushusertype(L, (void *)r_connect(self, dir), TOLUA_CAST "region");
+        return 1;
+    }
+    return 0;
 }
 
 static int tolua_region_get_flag(lua_State * L)
 {
-  region *self = (region *) tolua_tousertype(L, 1, 0);
-  int bit = (int)tolua_tonumber(L, 2, 0);
+    region *self = (region *)tolua_tousertype(L, 1, 0);
+    int bit = (int)tolua_tonumber(L, 2, 0);
 
-  lua_pushboolean(L, (self->flags & (1 << bit)));
-  return 1;
+    lua_pushboolean(L, (self->flags & (1 << bit)));
+    return 1;
 }
 
 static int tolua_region_set_flag(lua_State * L)
 {
-  region *self = (region *) tolua_tousertype(L, 1, 0);
-  int bit = (int)tolua_tonumber(L, 2, 0);
-  int set = tolua_toboolean(L, 3, 1);
+    region *self = (region *)tolua_tousertype(L, 1, 0);
+    int bit = (int)tolua_tonumber(L, 2, 0);
+    int set = tolua_toboolean(L, 3, 1);
 
-  if (set)
-    self->flags |= (1 << bit);
-  else
-    self->flags &= ~(1 << bit);
-  return 0;
+    if (set)
+        self->flags |= (1 << bit);
+    else
+        self->flags &= ~(1 << bit);
+    return 0;
 }
 
 static int tolua_region_get_resourcelevel(lua_State * L)
 {
-  region *r = (region *) tolua_tousertype(L, 1, 0);
-  const char *type = tolua_tostring(L, 2, 0);
-  const resource_type *rtype = rt_find(type);
-  if (rtype != NULL) {
-    const rawmaterial *rm;
-    for (rm = r->resources; rm; rm = rm->next) {
-      if (rm->type->rtype == rtype) {
-        tolua_pushnumber(L, (lua_Number) rm->level);
-        return 1;
-      }
+    region *r = (region *)tolua_tousertype(L, 1, 0);
+    const char *type = tolua_tostring(L, 2, 0);
+    const resource_type *rtype = rt_find(type);
+    if (rtype != NULL) {
+        const rawmaterial *rm;
+        for (rm = r->resources; rm; rm = rm->next) {
+            if (rm->type->rtype == rtype) {
+                tolua_pushnumber(L, (lua_Number)rm->level);
+                return 1;
+            }
+        }
     }
-  }
-  return 0;
+    return 0;
 }
 
 #define LUA_ASSERT(c, s) if (!(c)) { log_error("%s(%d): %s\n", __FILE__, __LINE__, (s)); return 0; }
 
 static critbit_tree * special_resources(void)
 {
-  static critbit_tree cb = CRITBIT_TREE();
-  if (!cb.root) {
-    const char * special[] = { "seed", "sapling", "tree", "grave", "chaos", 0 };
-    char buffer[32];
-    int i;
-    for (i=0;special[i];++i) {
-      size_t len = strlen(special[i]);
-      len = cb_new_kv(special[i], len, &i, sizeof(int), buffer);
-      cb_insert(&cb, buffer, len);
+    static critbit_tree cb = CRITBIT_TREE();
+    if (!cb.root) {
+        const char * special[] = { "seed", "sapling", "tree", "grave", "chaos", 0 };
+        char buffer[32];
+        int i;
+        for (i = 0; special[i]; ++i) {
+            size_t len = strlen(special[i]);
+            len = cb_new_kv(special[i], len, &i, sizeof(int), buffer);
+            cb_insert(&cb, buffer, len);
+        }
     }
-  }
-  return &cb;
+    return &cb;
 }
 
 static int tolua_region_get_resource(lua_State * L)
 {
-  region *r;
-  const char *type;
-  const resource_type *rtype;
-  int result = 0;
-  const void * matches;
-  critbit_tree * cb = special_resources();
+    region *r;
+    const char *type;
+    const resource_type *rtype;
+    int result = 0;
+    const void * matches;
+    critbit_tree * cb = special_resources();
 
-  r = (region *) tolua_tousertype(L, 1, 0);
-  LUA_ASSERT(r != NULL, "invalid parameter");
-  type = tolua_tostring(L, 2, 0);
-  LUA_ASSERT(type != NULL, "invalid parameter");
+    r = (region *)tolua_tousertype(L, 1, 0);
+    LUA_ASSERT(r != NULL, "invalid parameter");
+    type = tolua_tostring(L, 2, 0);
+    LUA_ASSERT(type != NULL, "invalid parameter");
 
-  if (cb_find_prefix(cb, type, strlen(type)+1, &matches, 1, 0)) {
-    cb_get_kv(matches, &result, sizeof(result));
-    switch (result) {
-    case 0:
-    case 1:
-    case 2:
-      result = rtrees(r, result);
-      break;
-    case 3:
-      result = deathcount(r);
-      break;
-    case 4:
-      result = get_chaoscount(r);
-      break;
+    if (cb_find_prefix(cb, type, strlen(type) + 1, &matches, 1, 0)) {
+        cb_get_kv(matches, &result, sizeof(result));
+        switch (result) {
+        case 0:
+        case 1:
+        case 2:
+            result = rtrees(r, result);
+            break;
+        case 3:
+            result = deathcount(r);
+            break;
+        case 4:
+            result = get_chaoscount(r);
+            break;
+        }
     }
-  } else {
-    rtype = rt_find(type);
-    if (rtype) {
-      result = region_getresource(r, rtype);
-    } else {
-      result = -1;
+    else {
+        rtype = rt_find(type);
+        if (rtype) {
+            result = region_getresource(r, rtype);
+        }
+        else {
+            result = -1;
+        }
     }
-  }
 
-  tolua_pushnumber(L, (lua_Number) result);
-  return 1;
+    tolua_pushnumber(L, (lua_Number)result);
+    return 1;
 }
 
 static int tolua_region_set_resource(lua_State * L)
 {
-  region *r = (region *) tolua_tousertype(L, 1, 0);
-  const char *type = tolua_tostring(L, 2, 0);
-  int result, value = (int)tolua_tonumber(L, 3, 0);
-  critbit_tree * cb = special_resources();
-  const void * matches;
+    region *r = (region *)tolua_tousertype(L, 1, 0);
+    const char *type = tolua_tostring(L, 2, 0);
+    int result, value = (int)tolua_tonumber(L, 3, 0);
+    critbit_tree * cb = special_resources();
+    const void * matches;
 
-  if (cb_find_prefix(cb, type, strlen(type)+1, &matches, 1, 0)) {
-    cb_get_kv(matches, &result, sizeof(result));
-    switch (result) {
-    case 0:
-    case 1:
-    case 2:
-      rsettrees(r, result, value);
-      break;
-    case 3:
-      deathcounts(r, value - deathcount(r));
-      break;
-    case 4:
-        add_chaoscount(r, value - get_chaoscount(r));
-      break;
+    if (cb_find_prefix(cb, type, strlen(type) + 1, &matches, 1, 0)) {
+        cb_get_kv(matches, &result, sizeof(result));
+        switch (result) {
+        case 0:
+        case 1:
+        case 2:
+            rsettrees(r, result, value);
+            break;
+        case 3:
+            deathcounts(r, value - deathcount(r));
+            break;
+        case 4:
+            add_chaoscount(r, value - get_chaoscount(r));
+            break;
+        }
     }
-  } else {
-    const resource_type *rtype = rt_find(type);
-    if (rtype != NULL) {
-      region_setresource(r, rtype, value);
+    else {
+        const resource_type *rtype = rt_find(type);
+        if (rtype != NULL) {
+            region_setresource(r, rtype, value);
+        }
     }
-  }
-  return 0;
+    return 0;
 }
 
 static int tolua_region_get_objects(lua_State * L)
 {
-  region *self = (region *) tolua_tousertype(L, 1, 0);
-  tolua_pushusertype(L, (void *)&self->attribs, TOLUA_CAST "hashtable");
-  return 1;
+    region *self = (region *)tolua_tousertype(L, 1, 0);
+    tolua_pushusertype(L, (void *)&self->attribs, TOLUA_CAST "hashtable");
+    return 1;
 }
 
 static int tolua_region_destroy(lua_State * L)
 {
-  region *self = (region *) tolua_tousertype(L, 1, 0);
-  remove_region(&regions, self);
-  return 0;
+    region *self = (region *)tolua_tousertype(L, 1, 0);
+    remove_region(&regions, self);
+    return 0;
 }
 
 static int tolua_region_create(lua_State * L)
 {
-  int x = (int)tolua_tonumber(L, 1, 0);
-  int y = (int)tolua_tonumber(L, 2, 0);
-  const char *tname = tolua_tostring(L, 3, 0);
-  if (tname) {
-    plane *pl = findplane(x, y);
-    const terrain_type *terrain = get_terrain(tname);
-    region *r, *result;
-    if (!terrain) {
-      return 0;
-    }
+    int x = (int)tolua_tonumber(L, 1, 0);
+    int y = (int)tolua_tonumber(L, 2, 0);
+    const char *tname = tolua_tostring(L, 3, 0);
+    if (tname) {
+        plane *pl = findplane(x, y);
+        const terrain_type *terrain = get_terrain(tname);
+        region *r, *result;
+        if (!terrain) {
+            return 0;
+        }
 
-    assert(!pnormalize(&x, &y, pl));
-    r = result = findregion(x, y);
+        assert(!pnormalize(&x, &y, pl));
+        r = result = findregion(x, y);
 
-    if (terrain == NULL && r != NULL && r->units != NULL) {
-      /* TODO: error message */
-      result = NULL;
-    } else if (r == NULL) {
-      result = new_region(x, y, pl, 0);
-    }
-    if (result) {
-      terraform_region(result, terrain);
-    }
-    if (result->land) {
-        fix_demand(result);
-    }
+        if (terrain == NULL && r != NULL && r->units != NULL) {
+            /* TODO: error message */
+            result = NULL;
+        }
+        else if (r == NULL) {
+            result = new_region(x, y, pl, 0);
+        }
+        if (result) {
+            terraform_region(result, terrain);
+        }
+        if (result->land) {
+            fix_demand(result);
+        }
 
-    tolua_pushusertype(L, result, TOLUA_CAST "region");
-    return 1;
-  }
-  return 0;
+        tolua_pushusertype(L, result, TOLUA_CAST "region");
+        return 1;
+    }
+    return 0;
 }
 
 static int tolua_region_get_units(lua_State * L)
 {
-  region *self = (region *) tolua_tousertype(L, 1, 0);
-  unit **unit_ptr = (unit **) lua_newuserdata(L, sizeof(unit *));
+    region *self = (region *)tolua_tousertype(L, 1, 0);
+    unit **unit_ptr = (unit **)lua_newuserdata(L, sizeof(unit *));
 
-  luaL_getmetatable(L, "unit");
-  lua_setmetatable(L, -2);
+    luaL_getmetatable(L, "unit");
+    lua_setmetatable(L, -2);
 
-  *unit_ptr = self->units;
+    *unit_ptr = self->units;
 
-  lua_pushcclosure(L, tolua_unitlist_next, 1);
-  return 1;
+    lua_pushcclosure(L, tolua_unitlist_next, 1);
+    return 1;
 }
 
 static int tolua_region_get_buildings(lua_State * L)
 {
-  region *self = (region *) tolua_tousertype(L, 1, 0);
-  building **building_ptr =
-    (building **) lua_newuserdata(L, sizeof(building *));
+    region *self = (region *)tolua_tousertype(L, 1, 0);
+    building **building_ptr =
+        (building **)lua_newuserdata(L, sizeof(building *));
 
-  luaL_getmetatable(L, "building");
-  lua_setmetatable(L, -2);
+    luaL_getmetatable(L, "building");
+    lua_setmetatable(L, -2);
 
-  *building_ptr = self->buildings;
+    *building_ptr = self->buildings;
 
-  lua_pushcclosure(L, tolua_buildinglist_next, 1);
-  return 1;
+    lua_pushcclosure(L, tolua_buildinglist_next, 1);
+    return 1;
 }
 
 static int tolua_region_get_ships(lua_State * L)
 {
-  region *self = (region *) tolua_tousertype(L, 1, 0);
-  ship **ship_ptr = (ship **) lua_newuserdata(L, sizeof(ship *));
+    region *self = (region *)tolua_tousertype(L, 1, 0);
+    ship **ship_ptr = (ship **)lua_newuserdata(L, sizeof(ship *));
 
-  luaL_getmetatable(L, "ship");
-  lua_setmetatable(L, -2);
+    luaL_getmetatable(L, "ship");
+    lua_setmetatable(L, -2);
 
-  *ship_ptr = self->ships;
+    *ship_ptr = self->ships;
 
-  lua_pushcclosure(L, tolua_shiplist_next, 1);
-  return 1;
+    lua_pushcclosure(L, tolua_shiplist_next, 1);
+    return 1;
 }
 
 static int tolua_region_get_age(lua_State * L)
 {
-  region *self = (region *) tolua_tousertype(L, 1, 0);
+    region *self = (region *)tolua_tousertype(L, 1, 0);
 
-  if (self) {
-    lua_pushnumber(L, self->age);
-    return 1;
-  }
-  return 0;
+    if (self) {
+        lua_pushnumber(L, self->age);
+        return 1;
+    }
+    return 0;
 }
 
 static int tolua_region_getkey(lua_State * L)
 {
-  region *self = (region *) tolua_tousertype(L, 1, 0);
-  const char *name = tolua_tostring(L, 2, 0);
+    region *self = (region *)tolua_tousertype(L, 1, 0);
+    const char *name = tolua_tostring(L, 2, 0);
 
-  int flag = atoi36(name);
-  attrib *a = find_key(self->attribs, flag);
-  lua_pushboolean(L, a != NULL);
+    int flag = atoi36(name);
+    attrib *a = find_key(self->attribs, flag);
+    lua_pushboolean(L, a != NULL);
 
-  return 1;
+    return 1;
 }
 
 static int tolua_region_setkey(lua_State * L)
 {
-  region *self = (region *) tolua_tousertype(L, 1, 0);
-  const char *name = tolua_tostring(L, 2, 0);
-  int value = tolua_toboolean(L, 3, 0);
+    region *self = (region *)tolua_tousertype(L, 1, 0);
+    const char *name = tolua_tostring(L, 2, 0);
+    int value = tolua_toboolean(L, 3, 0);
 
-  int flag = atoi36(name);
-  attrib *a = find_key(self->attribs, flag);
-  if (a == NULL && value) {
-    add_key(&self->attribs, flag);
-  } else if (a != NULL && !value) {
-    a_remove(&self->attribs, a);
-  }
-  return 0;
+    int flag = atoi36(name);
+    attrib *a = find_key(self->attribs, flag);
+    if (a == NULL && value) {
+        add_key(&self->attribs, flag);
+    }
+    else if (a != NULL && !value) {
+        a_remove(&self->attribs, a);
+    }
+    return 0;
 }
 
 static int tolua_region_tostring(lua_State * L)
 {
-  region *self = (region *) tolua_tousertype(L, 1, 0);
-  lua_pushstring(L, regionname(self, NULL));
-  return 1;
+    region *self = (region *)tolua_tousertype(L, 1, 0);
+    lua_pushstring(L, regionname(self, NULL));
+    return 1;
 }
 
 static int tolua_plane_get(lua_State * L)
 {
-  int id = (int)tolua_tonumber(L, 1, 0);
-  plane *pl = getplanebyid(id);
+    int id = (int)tolua_tonumber(L, 1, 0);
+    plane *pl = getplanebyid(id);
 
-  tolua_pushusertype(L, pl, TOLUA_CAST "plane");
-  return 1;
+    tolua_pushusertype(L, pl, TOLUA_CAST "plane");
+    return 1;
 }
 
 static int tolua_plane_create(lua_State * L)
 {
-  int id = (int)tolua_tonumber(L, 1, 0);
-  int x = (int)tolua_tonumber(L, 2, 0);
-  int y = (int)tolua_tonumber(L, 3, 0);
-  int width = (int)tolua_tonumber(L, 4, 0);
-  int height = (int)tolua_tonumber(L, 5, 0);
-  const char *name = tolua_tostring(L, 6, 0);
-  plane *pl;
+    int id = (int)tolua_tonumber(L, 1, 0);
+    int x = (int)tolua_tonumber(L, 2, 0);
+    int y = (int)tolua_tonumber(L, 3, 0);
+    int width = (int)tolua_tonumber(L, 4, 0);
+    int height = (int)tolua_tonumber(L, 5, 0);
+    const char *name = tolua_tostring(L, 6, 0);
+    plane *pl;
 
-  pl = create_new_plane(id, name, x, x + width - 1, y, y + height - 1, 0);
+    pl = create_new_plane(id, name, x, x + width - 1, y, y + height - 1, 0);
 
-  tolua_pushusertype(L, pl, TOLUA_CAST "plane");
-  return 1;
+    tolua_pushusertype(L, pl, TOLUA_CAST "plane");
+    return 1;
 }
 
 static int tolua_plane_get_name(lua_State * L)
 {
-  plane *self = (plane *) tolua_tousertype(L, 1, 0);
-  tolua_pushstring(L, self->name);
-  return 1;
+    plane *self = (plane *)tolua_tousertype(L, 1, 0);
+    tolua_pushstring(L, self->name);
+    return 1;
 }
 
 static int tolua_plane_set_name(lua_State * L)
 {
-  plane *self = (plane *) tolua_tousertype(L, 1, 0);
-  const char *str = tolua_tostring(L, 2, 0);
-  free(self->name);
-  if (str)
-    self->name = _strdup(str);
-  else
-    self->name = 0;
-  return 0;
+    plane *self = (plane *)tolua_tousertype(L, 1, 0);
+    const char *str = tolua_tostring(L, 2, 0);
+    free(self->name);
+    if (str)
+        self->name = _strdup(str);
+    else
+        self->name = 0;
+    return 0;
 }
 
 static int tolua_plane_get_id(lua_State * L)
 {
-  plane *self = (plane *) tolua_tousertype(L, 1, 0);
-  tolua_pushnumber(L, (lua_Number) self->id);
-  return 1;
+    plane *self = (plane *)tolua_tousertype(L, 1, 0);
+    tolua_pushnumber(L, (lua_Number)self->id);
+    return 1;
 }
 
 static int tolua_plane_normalize(lua_State * L)
 {
-  plane *self = (plane *) tolua_tousertype(L, 1, 0);
-  int x = (int)tolua_tonumber(L, 2, 0);
-  int y = (int)tolua_tonumber(L, 3, 0);
-  pnormalize(&x, &y, self);
-  tolua_pushnumber(L, (lua_Number) x);
-  tolua_pushnumber(L, (lua_Number) y);
-  return 2;
+    plane *self = (plane *)tolua_tousertype(L, 1, 0);
+    int x = (int)tolua_tonumber(L, 2, 0);
+    int y = (int)tolua_tonumber(L, 3, 0);
+    pnormalize(&x, &y, self);
+    tolua_pushnumber(L, (lua_Number)x);
+    tolua_pushnumber(L, (lua_Number)y);
+    return 2;
 }
 
 static int tolua_plane_tostring(lua_State * L)
 {
-  plane *self = (plane *) tolua_tousertype(L, 1, 0);
-  lua_pushstring(L, self->name);
-  return 1;
+    plane *self = (plane *)tolua_tousertype(L, 1, 0);
+    lua_pushstring(L, self->name);
+    return 1;
 }
 
 static int tolua_plane_get_size(lua_State * L)
 {
-  plane *pl = (plane *) tolua_tousertype(L, 1, 0);
-  lua_pushnumber(L, plane_width(pl));
-  lua_pushnumber(L, plane_height(pl));
-  return 2;
+    plane *pl = (plane *)tolua_tousertype(L, 1, 0);
+    lua_pushnumber(L, plane_width(pl));
+    lua_pushnumber(L, plane_height(pl));
+    return 2;
 }
 
 static int tolua_distance(lua_State * L)
 {
-  int x1 = (int)tolua_tonumber(L, 1, 0);
-  int y1 = (int)tolua_tonumber(L, 2, 0);
-  int x2 = (int)tolua_tonumber(L, 3, 0);
-  int y2 = (int)tolua_tonumber(L, 4, 0);
-  plane *pl = (plane *) tolua_tousertype(L, 5, 0);
-  int result;
+    int x1 = (int)tolua_tonumber(L, 1, 0);
+    int y1 = (int)tolua_tonumber(L, 2, 0);
+    int x2 = (int)tolua_tonumber(L, 3, 0);
+    int y2 = (int)tolua_tonumber(L, 4, 0);
+    plane *pl = (plane *)tolua_tousertype(L, 5, 0);
+    int result;
 
-  if (!pl)
-    pl = get_homeplane();
-  pnormalize(&x1, &y1, pl);
-  pnormalize(&x2, &y2, pl);
-  result = koor_distance(x1, y1, x2, y2);
-  lua_pushnumber(L, result);
-  return 1;
+    if (!pl)
+        pl = get_homeplane();
+    pnormalize(&x1, &y1, pl);
+    pnormalize(&x2, &y2, pl);
+    result = koor_distance(x1, y1, x2, y2);
+    lua_pushnumber(L, result);
+    return 1;
 }
 
 void tolua_region_open(lua_State * L)
 {
-  /* register user types */
-  tolua_usertype(L, TOLUA_CAST "region");
-  tolua_usertype(L, TOLUA_CAST "plane");
+    /* register user types */
+    tolua_usertype(L, TOLUA_CAST "region");
+    tolua_usertype(L, TOLUA_CAST "plane");
 
-  tolua_module(L, NULL, 0);
-  tolua_beginmodule(L, NULL);
-  {
-    tolua_function(L, TOLUA_CAST "distance", tolua_distance);
-
-    tolua_cclass(L, TOLUA_CAST "region", TOLUA_CAST "region", TOLUA_CAST "",
-      NULL);
-    tolua_beginmodule(L, TOLUA_CAST "region");
+    tolua_module(L, NULL, 0);
+    tolua_beginmodule(L, NULL);
     {
-      tolua_function(L, TOLUA_CAST "create", tolua_region_create);
-      tolua_function(L, TOLUA_CAST "destroy", tolua_region_destroy);
-      tolua_function(L, TOLUA_CAST "__tostring", tolua_region_tostring);
+        tolua_function(L, TOLUA_CAST "distance", tolua_distance);
 
-      /* flags */
-      tolua_variable(L, TOLUA_CAST "blocked", tolua_region_get_blocked, tolua_region_set_blocked);
+        tolua_cclass(L, TOLUA_CAST "region", TOLUA_CAST "region", TOLUA_CAST "",
+            NULL);
+        tolua_beginmodule(L, TOLUA_CAST "region");
+        {
+            tolua_function(L, TOLUA_CAST "create", tolua_region_create);
+            tolua_function(L, TOLUA_CAST "destroy", tolua_region_destroy);
+            tolua_function(L, TOLUA_CAST "__tostring", tolua_region_tostring);
 
-      tolua_variable(L, TOLUA_CAST "id", tolua_region_get_id, NULL);
-      tolua_variable(L, TOLUA_CAST "x", tolua_region_get_x, NULL);
-      tolua_variable(L, TOLUA_CAST "y", tolua_region_get_y, NULL);
-      tolua_variable(L, TOLUA_CAST "plane", tolua_region_get_plane, NULL);
-      tolua_variable(L, TOLUA_CAST "name", tolua_region_get_name,
-        tolua_region_set_name);
-      tolua_variable(L, TOLUA_CAST "morale", tolua_region_get_morale,
-        tolua_region_set_morale);
-      tolua_variable(L, TOLUA_CAST "info", tolua_region_get_info,
-        tolua_region_set_info);
-      tolua_variable(L, TOLUA_CAST "units", tolua_region_get_units, NULL);
-      tolua_variable(L, TOLUA_CAST "ships", tolua_region_get_ships, NULL);
-      tolua_variable(L, TOLUA_CAST "age", tolua_region_get_age, NULL);
-      tolua_variable(L, TOLUA_CAST "buildings", tolua_region_get_buildings,
-        NULL);
-      tolua_variable(L, TOLUA_CAST "terrain", tolua_region_get_terrain,
-        tolua_region_set_terrain);
-      tolua_function(L, TOLUA_CAST "get_resourcelevel",
-        tolua_region_get_resourcelevel);
-      tolua_function(L, TOLUA_CAST "get_resource", tolua_region_get_resource);
-      tolua_function(L, TOLUA_CAST "set_resource", tolua_region_set_resource);
-      tolua_function(L, TOLUA_CAST "get_flag", tolua_region_get_flag);
-      tolua_function(L, TOLUA_CAST "set_flag", tolua_region_set_flag);
-      tolua_function(L, TOLUA_CAST "next", tolua_region_get_next);
-      tolua_variable(L, TOLUA_CAST "adj", tolua_region_get_adj, NULL);
+            /* flags */
+            tolua_variable(L, TOLUA_CAST "blocked", tolua_region_get_blocked, tolua_region_set_blocked);
 
-      tolua_variable(L, TOLUA_CAST "luxury", &tolua_region_get_luxury,
-        &tolua_region_set_luxury);
-      tolua_variable(L, TOLUA_CAST "herb", &tolua_region_get_herb,
-        &tolua_region_set_herb);
+            tolua_variable(L, TOLUA_CAST "id", tolua_region_get_id, NULL);
+            tolua_variable(L, TOLUA_CAST "x", tolua_region_get_x, NULL);
+            tolua_variable(L, TOLUA_CAST "y", tolua_region_get_y, NULL);
+            tolua_variable(L, TOLUA_CAST "plane", tolua_region_get_plane, NULL);
+            tolua_variable(L, TOLUA_CAST "name", tolua_region_get_name,
+                tolua_region_set_name);
+            tolua_variable(L, TOLUA_CAST "morale", tolua_region_get_morale,
+                tolua_region_set_morale);
+            tolua_variable(L, TOLUA_CAST "info", tolua_region_get_info,
+                tolua_region_set_info);
+            tolua_variable(L, TOLUA_CAST "units", tolua_region_get_units, NULL);
+            tolua_variable(L, TOLUA_CAST "ships", tolua_region_get_ships, NULL);
+            tolua_variable(L, TOLUA_CAST "age", tolua_region_get_age, NULL);
+            tolua_variable(L, TOLUA_CAST "buildings", tolua_region_get_buildings,
+                NULL);
+            tolua_variable(L, TOLUA_CAST "terrain", tolua_region_get_terrain,
+                tolua_region_set_terrain);
+            tolua_function(L, TOLUA_CAST "get_resourcelevel",
+                tolua_region_get_resourcelevel);
+            tolua_function(L, TOLUA_CAST "get_resource", tolua_region_get_resource);
+            tolua_function(L, TOLUA_CAST "set_resource", tolua_region_set_resource);
+            tolua_function(L, TOLUA_CAST "get_flag", tolua_region_get_flag);
+            tolua_function(L, TOLUA_CAST "set_flag", tolua_region_set_flag);
+            tolua_function(L, TOLUA_CAST "next", tolua_region_get_next);
+            tolua_variable(L, TOLUA_CAST "adj", tolua_region_get_adj, NULL);
 
-      tolua_variable(L, TOLUA_CAST "terrain_name",
-        &tolua_region_get_terrainname, &tolua_region_set_terrainname);
-      tolua_variable(L, TOLUA_CAST "owner", &tolua_region_get_owner,
-        &tolua_region_set_owner);
+            tolua_variable(L, TOLUA_CAST "luxury", &tolua_region_get_luxury,
+                &tolua_region_set_luxury);
+            tolua_variable(L, TOLUA_CAST "herb", &tolua_region_get_herb,
+                &tolua_region_set_herb);
 
-      tolua_function(L, TOLUA_CAST "get_key", tolua_region_getkey);
-      tolua_function(L, TOLUA_CAST "set_key", tolua_region_setkey);
+            tolua_variable(L, TOLUA_CAST "terrain_name",
+                &tolua_region_get_terrainname, &tolua_region_set_terrainname);
+            tolua_variable(L, TOLUA_CAST "owner", &tolua_region_get_owner,
+                &tolua_region_set_owner);
 
-      tolua_variable(L, TOLUA_CAST "objects", tolua_region_get_objects, 0);
+            tolua_function(L, TOLUA_CAST "get_key", tolua_region_getkey);
+            tolua_function(L, TOLUA_CAST "set_key", tolua_region_setkey);
+
+            tolua_variable(L, TOLUA_CAST "objects", tolua_region_get_objects, 0);
+        }
+        tolua_endmodule(L);
+
+        tolua_cclass(L, TOLUA_CAST "plane", TOLUA_CAST "plane", TOLUA_CAST "",
+            NULL);
+        tolua_beginmodule(L, TOLUA_CAST "plane");
+        {
+            tolua_function(L, TOLUA_CAST "create", tolua_plane_create);
+            tolua_function(L, TOLUA_CAST "get", tolua_plane_get);
+            tolua_function(L, TOLUA_CAST "__tostring", tolua_plane_tostring);
+
+            tolua_function(L, TOLUA_CAST "size", tolua_plane_get_size);
+            tolua_variable(L, TOLUA_CAST "id", tolua_plane_get_id, NULL);
+            tolua_function(L, TOLUA_CAST "normalize", tolua_plane_normalize);
+            tolua_variable(L, TOLUA_CAST "name", tolua_plane_get_name,
+                tolua_plane_set_name);
+        }
+        tolua_endmodule(L);
     }
     tolua_endmodule(L);
-
-    tolua_cclass(L, TOLUA_CAST "plane", TOLUA_CAST "plane", TOLUA_CAST "",
-      NULL);
-    tolua_beginmodule(L, TOLUA_CAST "plane");
-    {
-      tolua_function(L, TOLUA_CAST "create", tolua_plane_create);
-      tolua_function(L, TOLUA_CAST "get", tolua_plane_get);
-      tolua_function(L, TOLUA_CAST "__tostring", tolua_plane_tostring);
-
-      tolua_function(L, TOLUA_CAST "size", tolua_plane_get_size);
-      tolua_variable(L, TOLUA_CAST "id", tolua_plane_get_id, NULL);
-      tolua_function(L, TOLUA_CAST "normalize", tolua_plane_normalize);
-      tolua_variable(L, TOLUA_CAST "name", tolua_plane_get_name,
-        tolua_plane_set_name);
-    }
-    tolua_endmodule(L);
-  }
-  tolua_endmodule(L);
 }
diff --git a/src/bind_region.h b/src/bind_region.h
index f8d0c8e2a..c8dcc840b 100644
--- a/src/bind_region.h
+++ b/src/bind_region.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
 +-------------------+
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Christian Schlittchen <corwin@amber.kn-bremen.de>
diff --git a/src/bind_settings.c b/src/bind_settings.c
index 1224939a9..b0a82baaa 100755
--- a/src/bind_settings.c
+++ b/src/bind_settings.c
@@ -5,10 +5,10 @@
 
 const char * settings_get(const char *key)
 {
-  return get_param(global.parameters, key);
+    return get_param(global.parameters, key);
 }
 
 void settings_set(const char *key, const char *value)
 {
-  set_param(&global.parameters, key, value);
+    set_param(&global.parameters, key, value);
 }
diff --git a/src/bind_settings.h b/src/bind_settings.h
index 80f0e998c..7f01c3856 100755
--- a/src/bind_settings.h
+++ b/src/bind_settings.h
@@ -4,8 +4,8 @@
 extern "C" {
 #endif
 
-const char * settings_get(const char *key);
-void settings_set(const char *key, const char *value);
+    const char * settings_get(const char *key);
+    void settings_set(const char *key, const char *value);
 
 #ifdef __cplusplus
 }
diff --git a/src/bind_ship.c b/src/bind_ship.c
index 1c94a232d..f87ef3575 100644
--- a/src/bind_ship.c
+++ b/src/bind_ship.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
 +-------------------+
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Christian Schlittchen <corwin@amber.kn-bremen.de>
@@ -30,67 +30,68 @@ without prior permission by the authors of Eressea.
 
 int tolua_shiplist_next(lua_State * L)
 {
-  ship **ship_ptr = (ship **) lua_touserdata(L, lua_upvalueindex(1));
-  ship *u = *ship_ptr;
-  if (u != NULL) {
-    tolua_pushusertype(L, (void *)u, TOLUA_CAST "ship");
-    *ship_ptr = u->next;
-    return 1;
-  } else
-    return 0;                   /* no more values to return */
+    ship **ship_ptr = (ship **)lua_touserdata(L, lua_upvalueindex(1));
+    ship *u = *ship_ptr;
+    if (u != NULL) {
+        tolua_pushusertype(L, (void *)u, TOLUA_CAST "ship");
+        *ship_ptr = u->next;
+        return 1;
+    }
+    else
+        return 0;                   /* no more values to return */
 }
 
 static int tolua_ship_get_id(lua_State * L)
 {
-  ship *self = (ship *) tolua_tousertype(L, 1, 0);
-  tolua_pushnumber(L, (lua_Number) self->no);
-  return 1;
+    ship *self = (ship *)tolua_tousertype(L, 1, 0);
+    tolua_pushnumber(L, (lua_Number)self->no);
+    return 1;
 }
 
 static int tolua_ship_get_name(lua_State * L)
 {
-  ship *self = (ship *) tolua_tousertype(L, 1, 0);
-  tolua_pushstring(L, ship_getname(self));
-  return 1;
+    ship *self = (ship *)tolua_tousertype(L, 1, 0);
+    tolua_pushstring(L, ship_getname(self));
+    return 1;
 }
 
 static int tolua_ship_get_display(lua_State * L)
 {
-  ship *self = (ship *) tolua_tousertype(L, 1, 0);
-  tolua_pushstring(L, self->display);
-  return 1;
+    ship *self = (ship *)tolua_tousertype(L, 1, 0);
+    tolua_pushstring(L, self->display);
+    return 1;
 }
 
 static int tolua_ship_get_region(lua_State * L)
 {
-  ship *self = (ship *) tolua_tousertype(L, 1, 0);
-  if (self) {
-    tolua_pushusertype(L, self->region, TOLUA_CAST "region");
-    return 1;
-  }
-  return 0;
+    ship *self = (ship *)tolua_tousertype(L, 1, 0);
+    if (self) {
+        tolua_pushusertype(L, self->region, TOLUA_CAST "region");
+        return 1;
+    }
+    return 0;
 }
 
 static int tolua_ship_set_region(lua_State * L)
 {
-  ship *self = (ship *) tolua_tousertype(L, 1, 0);
-  region *r = (region *) tolua_tousertype(L, 1, 0);
-  if (self) {
-    move_ship(self, self->region, r, NULL);
-  }
-  return 0;
+    ship *self = (ship *)tolua_tousertype(L, 1, 0);
+    region *r = (region *)tolua_tousertype(L, 1, 0);
+    if (self) {
+        move_ship(self, self->region, r, NULL);
+    }
+    return 0;
 }
 
 static int tolua_ship_set_name(lua_State * L)
 {
-  ship *self = (ship *) tolua_tousertype(L, 1, 0);
-  ship_setname(self, tolua_tostring(L, 2, 0));
-  return 0;
+    ship *self = (ship *)tolua_tousertype(L, 1, 0);
+    ship_setname(self, tolua_tostring(L, 2, 0));
+    return 0;
 }
 
 static int tolua_ship_set_display(lua_State * L)
 {
-    ship *self = (ship *) tolua_tousertype(L, 1, 0);
+    ship *self = (ship *)tolua_tousertype(L, 1, 0);
     free(self->display);
     self->display = _strdup(tolua_tostring(L, 2, 0));
     return 0;
@@ -98,133 +99,135 @@ static int tolua_ship_set_display(lua_State * L)
 
 static int tolua_ship_get_units(lua_State * L)
 {
-  ship *self = (ship *) tolua_tousertype(L, 1, 0);
-  unit **unit_ptr = (unit **) lua_newuserdata(L, sizeof(unit *));
-  unit *u = self->region->units;
+    ship *self = (ship *)tolua_tousertype(L, 1, 0);
+    unit **unit_ptr = (unit **)lua_newuserdata(L, sizeof(unit *));
+    unit *u = self->region->units;
 
-  while (u && u->ship != self)
-    u = u->next;
-  luaL_getmetatable(L, TOLUA_CAST "unit");
-  lua_setmetatable(L, -2);
+    while (u && u->ship != self)
+        u = u->next;
+    luaL_getmetatable(L, TOLUA_CAST "unit");
+    lua_setmetatable(L, -2);
 
-  *unit_ptr = u;
+    *unit_ptr = u;
 
-  lua_pushcclosure(L, tolua_unitlist_nexts, 1);
-  return 1;
+    lua_pushcclosure(L, tolua_unitlist_nexts, 1);
+    return 1;
 }
 
 static int tolua_ship_get_objects(lua_State * L)
 {
-  ship *self = (ship *) tolua_tousertype(L, 1, 0);
-  tolua_pushusertype(L, (void *)&self->attribs, TOLUA_CAST "hashtable");
-  return 1;
+    ship *self = (ship *)tolua_tousertype(L, 1, 0);
+    tolua_pushusertype(L, (void *)&self->attribs, TOLUA_CAST "hashtable");
+    return 1;
 }
 
 static int tolua_ship_create(lua_State * L)
 {
-  region *r = (region *) tolua_tousertype(L, 1, 0);
-  const char *sname = tolua_tostring(L, 2, 0);
-  if (sname) {
-    const ship_type *stype = st_find(sname);
-    if (stype) {
-      ship *sh = new_ship(stype, r, default_locale);
-      sh->size = stype->construction ? stype->construction->maxsize : 1;
-      tolua_pushusertype(L, (void *)sh, TOLUA_CAST "ship");
-      return 1;
-    } else {
-        log_error("Unknown ship type '%s'\n", sname);
+    region *r = (region *)tolua_tousertype(L, 1, 0);
+    const char *sname = tolua_tostring(L, 2, 0);
+    if (sname) {
+        const ship_type *stype = st_find(sname);
+        if (stype) {
+            ship *sh = new_ship(stype, r, default_locale);
+            sh->size = stype->construction ? stype->construction->maxsize : 1;
+            tolua_pushusertype(L, (void *)sh, TOLUA_CAST "ship");
+            return 1;
+        }
+        else {
+            log_error("Unknown ship type '%s'\n", sname);
+        }
     }
-  }
-  return 0;
+    return 0;
 }
 
 static int
- tolua_ship_tostring(lua_State * L)
+tolua_ship_tostring(lua_State * L)
 {
-  ship *self = (ship *) tolua_tousertype(L, 1, 0);
-  lua_pushstring(L, shipname(self));
-  return 1;
+    ship *self = (ship *)tolua_tousertype(L, 1, 0);
+    lua_pushstring(L, shipname(self));
+    return 1;
 }
 
 static int tolua_ship_get_flags(lua_State * L)
 {
-  ship *self = (ship *) tolua_tousertype(L, 1, 0);
-  tolua_pushnumber(L, (lua_Number) self->flags);
-  return 1;
+    ship *self = (ship *)tolua_tousertype(L, 1, 0);
+    tolua_pushnumber(L, (lua_Number)self->flags);
+    return 1;
 }
 
 static int tolua_ship_set_flags(lua_State * L)
 {
-  ship *self = (ship *) tolua_tousertype(L, 1, 0);
-  self->flags = (int)tolua_tonumber(L, 2, 0);
-  return 0;
+    ship *self = (ship *)tolua_tousertype(L, 1, 0);
+    self->flags = (int)tolua_tonumber(L, 2, 0);
+    return 0;
 }
 
 static int tolua_ship_set_coast(lua_State * L)
 {
-  ship *self = (ship *) tolua_tousertype(L, 1, 0);
-  if (lua_isnil(L, 2)) {
-    self->coast = NODIRECTION;
-  } else if (lua_isnumber(L, 2)) {
-    self->coast = (direction_t) tolua_tonumber(L, 2, 0);
-  }
-  return 0;
+    ship *self = (ship *)tolua_tousertype(L, 1, 0);
+    if (lua_isnil(L, 2)) {
+        self->coast = NODIRECTION;
+    }
+    else if (lua_isnumber(L, 2)) {
+        self->coast = (direction_t)tolua_tonumber(L, 2, 0);
+    }
+    return 0;
 }
 
 static int tolua_ship_get_coast(lua_State * L)
 {
-  ship *self = (ship *) tolua_tousertype(L, 1, 0);
-  if (self->coast) {
-    tolua_pushnumber(L, self->coast);
-    return 1;
-  }
-  return 0;
+    ship *self = (ship *)tolua_tousertype(L, 1, 0);
+    if (self->coast) {
+        tolua_pushnumber(L, self->coast);
+        return 1;
+    }
+    return 0;
 }
 
 static int tolua_ship_get_type(lua_State * L)
 {
-    ship *self = (ship *) tolua_tousertype(L, 1, 0);
+    ship *self = (ship *)tolua_tousertype(L, 1, 0);
     tolua_pushstring(L, self->type->_name);
     return 1;
 }
 
 void tolua_ship_open(lua_State * L)
 {
-  /* register user types */
-  tolua_usertype(L, TOLUA_CAST "ship");
+    /* register user types */
+    tolua_usertype(L, TOLUA_CAST "ship");
 
-  tolua_module(L, NULL, 0);
-  tolua_beginmodule(L, NULL);
-  {
-    tolua_cclass(L, TOLUA_CAST "ship", TOLUA_CAST "ship", TOLUA_CAST "", NULL);
-    tolua_beginmodule(L, TOLUA_CAST "ship");
+    tolua_module(L, NULL, 0);
+    tolua_beginmodule(L, NULL);
     {
-      tolua_function(L, TOLUA_CAST "__tostring", tolua_ship_tostring);
-      tolua_variable(L, TOLUA_CAST "id", tolua_ship_get_id, NULL);
-      tolua_variable(L, TOLUA_CAST "name", tolua_ship_get_name,
-        tolua_ship_set_name);
-      tolua_variable(L, TOLUA_CAST "info", tolua_ship_get_display,
-        tolua_ship_set_display);
-      tolua_variable(L, TOLUA_CAST "units", tolua_ship_get_units, NULL);
-      tolua_variable(L, TOLUA_CAST "flags", &tolua_ship_get_flags,
-        tolua_ship_set_flags);
-      tolua_variable(L, TOLUA_CAST "region", tolua_ship_get_region,
-        tolua_ship_set_region);
-      tolua_variable(L, TOLUA_CAST "coast", tolua_ship_get_coast,
-        tolua_ship_set_coast);
-      tolua_variable(L, TOLUA_CAST "type", tolua_ship_get_type, 0);
+        tolua_cclass(L, TOLUA_CAST "ship", TOLUA_CAST "ship", TOLUA_CAST "", NULL);
+        tolua_beginmodule(L, TOLUA_CAST "ship");
+        {
+            tolua_function(L, TOLUA_CAST "__tostring", tolua_ship_tostring);
+            tolua_variable(L, TOLUA_CAST "id", tolua_ship_get_id, NULL);
+            tolua_variable(L, TOLUA_CAST "name", tolua_ship_get_name,
+                tolua_ship_set_name);
+            tolua_variable(L, TOLUA_CAST "info", tolua_ship_get_display,
+                tolua_ship_set_display);
+            tolua_variable(L, TOLUA_CAST "units", tolua_ship_get_units, NULL);
+            tolua_variable(L, TOLUA_CAST "flags", &tolua_ship_get_flags,
+                tolua_ship_set_flags);
+            tolua_variable(L, TOLUA_CAST "region", tolua_ship_get_region,
+                tolua_ship_set_region);
+            tolua_variable(L, TOLUA_CAST "coast", tolua_ship_get_coast,
+                tolua_ship_set_coast);
+            tolua_variable(L, TOLUA_CAST "type", tolua_ship_get_type, 0);
 #ifdef TODO
-        .property("weight", &ship_getweight)
-        .property("capacity", &ship_getcapacity)
-        .property("maxsize", &ship_maxsize)
-        .def_readwrite("damage", &ship::damage)
-        .def_readwrite("size", &ship::size)
+            .property("weight", &ship_getweight)
+                .property("capacity", &ship_getcapacity)
+                .property("maxsize", &ship_maxsize)
+                .def_readwrite("damage", &ship::damage)
+                .def_readwrite("size", &ship::size)
 #endif
-        tolua_variable(L, TOLUA_CAST "objects", tolua_ship_get_objects, 0);
+                tolua_variable(L, TOLUA_CAST "objects", tolua_ship_get_objects, 0);
 
-      tolua_function(L, TOLUA_CAST "create", tolua_ship_create);
+            tolua_function(L, TOLUA_CAST "create", tolua_ship_create);
+        }
+        tolua_endmodule(L);
     }
     tolua_endmodule(L);
-  }
-  tolua_endmodule(L);
 }
diff --git a/src/bind_ship.h b/src/bind_ship.h
index 7c9426fce..2bad027c9 100644
--- a/src/bind_ship.h
+++ b/src/bind_ship.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
 +-------------------+
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Christian Schlittchen <corwin@amber.kn-bremen.de>
diff --git a/src/bind_sqlite.c b/src/bind_sqlite.c
index 0029d1c2a..e2c0e69e3 100644
--- a/src/bind_sqlite.c
+++ b/src/bind_sqlite.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
 +-------------------+
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Christian Schlittchen <corwin@amber.kn-bremen.de>
diff --git a/src/bind_storage.c b/src/bind_storage.c
index baf1a67e2..d0fea8244 100644
--- a/src/bind_storage.c
+++ b/src/bind_storage.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
 +-------------------+
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Christian Schlittchen <corwin@amber.kn-bremen.de>
diff --git a/src/bind_storage.h b/src/bind_storage.h
index fd79c7ca8..a3944f19f 100644
--- a/src/bind_storage.h
+++ b/src/bind_storage.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
 +-------------------+
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Christian Schlittchen <corwin@amber.kn-bremen.de>
diff --git a/src/bind_unit.c b/src/bind_unit.c
index 58ca6cae2..f921d1e8d 100755
--- a/src/bind_unit.c
+++ b/src/bind_unit.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
 +-------------------+
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Christian Schlittchen <corwin@amber.kn-bremen.de>
@@ -58,793 +58,803 @@ without prior permission by the authors of Eressea.
 
 static int tolua_unit_get_objects(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  tolua_pushusertype(L, (void *)&self->attribs, TOLUA_CAST "hashtable");
-  return 1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    tolua_pushusertype(L, (void *)&self->attribs, TOLUA_CAST "hashtable");
+    return 1;
 }
 
 #ifdef BSON_ATTRIB
 static int tolua_unit_get_attribs(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  attrib **attrib_ptr = (attrib **) lua_newuserdata(L, sizeof(attrib *));
-  attrib *a = tolua_get_lua_ext(self->attribs);
+    unit *self = (unit *) tolua_tousertype(L, 1, 0);
+    attrib **attrib_ptr = (attrib **) lua_newuserdata(L, sizeof(attrib *));
+    attrib *a = tolua_get_lua_ext(self->attribs);
 
-  luaL_getmetatable(L, "attrib");
-  lua_setmetatable(L, -2);
+    luaL_getmetatable(L, "attrib");
+    lua_setmetatable(L, -2);
 
-  *attrib_ptr = a;
+    *attrib_ptr = a;
 
-  lua_pushcclosure(L, tolua_attriblist_next, 1);
-  return 1;
+    lua_pushcclosure(L, tolua_attriblist_next, 1);
+    return 1;
 }
 #endif
 
 int tolua_unitlist_nextf(lua_State * L)
 {
-  unit **unit_ptr = (unit **) lua_touserdata(L, lua_upvalueindex(1));
-  unit *u = *unit_ptr;
-  if (u != NULL) {
-    tolua_pushusertype(L, (void *)u, TOLUA_CAST "unit");
-    *unit_ptr = u->nextF;
-    return 1;
-  } else
-    return 0;                   /* no more values to return */
+    unit **unit_ptr = (unit **)lua_touserdata(L, lua_upvalueindex(1));
+    unit *u = *unit_ptr;
+    if (u != NULL) {
+        tolua_pushusertype(L, (void *)u, TOLUA_CAST "unit");
+        *unit_ptr = u->nextF;
+        return 1;
+    }
+    else
+        return 0;                   /* no more values to return */
 }
 
 int tolua_unitlist_nextb(lua_State * L)
 {
-  unit **unit_ptr = (unit **) lua_touserdata(L, lua_upvalueindex(1));
-  unit *u = *unit_ptr;
-  if (u != NULL) {
-    unit *unext = u->next;
-    tolua_pushusertype(L, (void *)u, TOLUA_CAST "unit");
+    unit **unit_ptr = (unit **)lua_touserdata(L, lua_upvalueindex(1));
+    unit *u = *unit_ptr;
+    if (u != NULL) {
+        unit *unext = u->next;
+        tolua_pushusertype(L, (void *)u, TOLUA_CAST "unit");
 
-    while (unext && unext->building != u->building) {
-      unext = unext->next;
+        while (unext && unext->building != u->building) {
+            unext = unext->next;
+        }
+        *unit_ptr = unext;
+
+        return 1;
     }
-    *unit_ptr = unext;
-
-    return 1;
-  } else
-    return 0;                   /* no more values to return */
+    else
+        return 0;                   /* no more values to return */
 }
 
 int tolua_unitlist_nexts(lua_State * L)
 {
-  unit **unit_ptr = (unit **) lua_touserdata(L, lua_upvalueindex(1));
-  unit *u = *unit_ptr;
-  if (u != NULL) {
-    unit *unext = u->next;
-    tolua_pushusertype(L, (void *)u, TOLUA_CAST "unit");
+    unit **unit_ptr = (unit **)lua_touserdata(L, lua_upvalueindex(1));
+    unit *u = *unit_ptr;
+    if (u != NULL) {
+        unit *unext = u->next;
+        tolua_pushusertype(L, (void *)u, TOLUA_CAST "unit");
 
-    while (unext && unext->ship != u->ship) {
-      unext = unext->next;
+        while (unext && unext->ship != u->ship) {
+            unext = unext->next;
+        }
+        *unit_ptr = unext;
+
+        return 1;
     }
-    *unit_ptr = unext;
-
-    return 1;
-  } else
-    return 0;                   /* no more values to return */
+    else
+        return 0;                   /* no more values to return */
 }
 
 int tolua_unitlist_next(lua_State * L)
 {
-  unit **unit_ptr = (unit **) lua_touserdata(L, lua_upvalueindex(1));
-  unit *u = *unit_ptr;
-  if (u != NULL) {
-    tolua_pushusertype(L, (void *)u, TOLUA_CAST "unit");
-    *unit_ptr = u->next;
-    return 1;
-  } else
-    return 0;                   /* no more values to return */
+    unit **unit_ptr = (unit **)lua_touserdata(L, lua_upvalueindex(1));
+    unit *u = *unit_ptr;
+    if (u != NULL) {
+        tolua_pushusertype(L, (void *)u, TOLUA_CAST "unit");
+        *unit_ptr = u->next;
+        return 1;
+    }
+    else
+        return 0;                   /* no more values to return */
 }
 
 static int tolua_unit_get_group(lua_State * L)
 {
-  unit *u = (unit *) tolua_tousertype(L, 1, 0);
-  group *g = get_group(u);
-  if (g) {
-    tolua_pushstring(L, g->name);
-    return 1;
-  }
-  return 0;
+    unit *u = (unit *)tolua_tousertype(L, 1, 0);
+    group *g = get_group(u);
+    if (g) {
+        tolua_pushstring(L, g->name);
+        return 1;
+    }
+    return 0;
 }
 
 static int tolua_unit_set_group(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  int result = join_group(self, tolua_tostring(L, 2, 0));
-  tolua_pushnumber(L, result);
-  return 1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    int result = join_group(self, tolua_tostring(L, 2, 0));
+    tolua_pushnumber(L, result);
+    return 1;
 }
 
 static int tolua_unit_get_name(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  tolua_pushstring(L, self->name);
-  return 1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    tolua_pushstring(L, self->name);
+    return 1;
 }
 
 static int tolua_unit_set_name(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  unit_setname(self, tolua_tostring(L, 2, 0));
-  return 0;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    unit_setname(self, tolua_tostring(L, 2, 0));
+    return 0;
 }
 
 static int tolua_unit_get_info(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  tolua_pushstring(L, unit_getinfo(self));
-  return 1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    tolua_pushstring(L, unit_getinfo(self));
+    return 1;
 }
 
 static int tolua_unit_set_info(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  unit_setinfo(self, tolua_tostring(L, 2, 0));
-  return 0;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    unit_setinfo(self, tolua_tostring(L, 2, 0));
+    return 0;
 }
 
 static int tolua_unit_get_id(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  lua_pushinteger(L, unit_getid(self));
-  return 1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    lua_pushinteger(L, unit_getid(self));
+    return 1;
 }
 
 static int tolua_unit_set_id(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  unit_setid(self, (int)tolua_tonumber(L, 2, 0));
-  return 0;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    unit_setid(self, (int)tolua_tonumber(L, 2, 0));
+    return 0;
 }
 
 static int tolua_unit_get_hpmax(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  lua_pushinteger(L, unit_max_hp(self));
-  return 1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    lua_pushinteger(L, unit_max_hp(self));
+    return 1;
 }
 
 static int tolua_unit_get_hp(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  lua_pushinteger(L, unit_gethp(self));
-  return 1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    lua_pushinteger(L, unit_gethp(self));
+    return 1;
 }
 
 static int tolua_unit_set_hp(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  unit_sethp(self, (int)tolua_tonumber(L, 2, 0));
-  return 0;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    unit_sethp(self, (int)tolua_tonumber(L, 2, 0));
+    return 0;
 }
 
 static int tolua_unit_get_number(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  lua_pushinteger(L, self->number);
-  return 1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    lua_pushinteger(L, self->number);
+    return 1;
 }
 
 static int tolua_unit_set_number(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  int number = (int)tolua_tonumber(L, 2, 0);
-  if (self->number == 0) {
-    set_number(self, number);
-    self->hp = unit_max_hp(self) * number;
-  } else {
-    scale_number(self, number);
-  }
-  return 0;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    int number = (int)tolua_tonumber(L, 2, 0);
+    if (self->number == 0) {
+        set_number(self, number);
+        self->hp = unit_max_hp(self) * number;
+    }
+    else {
+        scale_number(self, number);
+    }
+    return 0;
 }
 
 static int tolua_unit_get_flags(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  lua_pushinteger(L, self->flags);
-  return 1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    lua_pushinteger(L, self->flags);
+    return 1;
 }
 
 static int tolua_unit_set_flags(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  self->flags = (int)tolua_tonumber(L, 2, 0);
-  return 0;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    self->flags = (int)tolua_tonumber(L, 2, 0);
+    return 0;
 }
 
 static const char *unit_getmagic(const unit * u)
 {
-  sc_mage *mage = get_mage(u);
-  return mage ? magic_school[mage->magietyp] : NULL;
+    sc_mage *mage = get_mage(u);
+    return mage ? magic_school[mage->magietyp] : NULL;
 }
 
 static int tolua_unit_get_magic(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  lua_pushstring(L, unit_getmagic(self));
-  return 1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    lua_pushstring(L, unit_getmagic(self));
+    return 1;
 }
 
 static void unit_setmagic(unit * u, const char *type)
 {
-  sc_mage *mage = get_mage(u);
-  int mtype;
-  for (mtype = 0; mtype != MAXMAGIETYP; ++mtype) {
-    if (strcmp(magic_school[mtype], type) == 0)
-      break;
-  }
-  if (mtype == MAXMAGIETYP)
-    return;
-  if (mage == NULL) {
-    mage = create_mage(u, (magic_t)mtype);
-  }
+    sc_mage *mage = get_mage(u);
+    int mtype;
+    for (mtype = 0; mtype != MAXMAGIETYP; ++mtype) {
+        if (strcmp(magic_school[mtype], type) == 0)
+            break;
+    }
+    if (mtype == MAXMAGIETYP)
+        return;
+    if (mage == NULL) {
+        mage = create_mage(u, (magic_t)mtype);
+    }
 }
 
 static int tolua_unit_set_magic(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  const char *type = tolua_tostring(L, 2, 0);
-  unit_setmagic(self, type);
-  return 0;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    const char *type = tolua_tostring(L, 2, 0);
+    unit_setmagic(self, type);
+    return 0;
 }
 
 static int tolua_unit_get_aura(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  lua_pushinteger(L, get_spellpoints(self));
-  return 1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    lua_pushinteger(L, get_spellpoints(self));
+    return 1;
 }
 
 static int tolua_unit_set_aura(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  set_spellpoints(self, (int)tolua_tonumber(L, 2, 0));
-  return 0;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    set_spellpoints(self, (int)tolua_tonumber(L, 2, 0));
+    return 0;
 }
 
 static int tolua_unit_get_age(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  lua_pushinteger(L, self->age);
-  return 1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    lua_pushinteger(L, self->age);
+    return 1;
 }
 
 static int tolua_unit_set_age(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  self->age = (short)tolua_tonumber(L, 2, 0);
-  return 0;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    self->age = (short)tolua_tonumber(L, 2, 0);
+    return 0;
 }
 
 static int tolua_unit_get_status(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  lua_pushinteger(L, unit_getstatus(self));
-  return 1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    lua_pushinteger(L, unit_getstatus(self));
+    return 1;
 }
 
 static int tolua_unit_set_status(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  unit_setstatus(self, (status_t) tolua_tonumber(L, 2, 0));
-  return 0;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    unit_setstatus(self, (status_t)tolua_tonumber(L, 2, 0));
+    return 0;
 }
 
 static int tolua_unit_get_item(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  const char *iname = tolua_tostring(L, 2, 0);
-  int result = -1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    const char *iname = tolua_tostring(L, 2, 0);
+    int result = -1;
 
-  if (iname != NULL) {
-    const item_type *itype = it_find(iname);
-    if (itype != NULL) {
-      result = i_get(self->items, itype);
+    if (iname != NULL) {
+        const item_type *itype = it_find(iname);
+        if (itype != NULL) {
+            result = i_get(self->items, itype);
+        }
     }
-  }
-  lua_pushinteger(L, result);
-  return 1;
+    lua_pushinteger(L, result);
+    return 1;
 }
 
 static int tolua_unit_get_effect(lua_State * L)
 {
-  const unit *self = (unit *)tolua_tousertype(L, 1, 0);
-  const char *potion_name = tolua_tostring(L, 2, 0);
-  int result = -1;
-  const potion_type *pt_potion;
-  const item_type *it_potion = it_find(potion_name);
+    const unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    const char *potion_name = tolua_tostring(L, 2, 0);
+    int result = -1;
+    const potion_type *pt_potion;
+    const item_type *it_potion = it_find(potion_name);
 
-  if (it_potion != NULL) {
-    pt_potion = it_potion->rtype->ptype;
-    if (pt_potion != NULL)
-      result = get_effect(self, pt_potion);
-  }
+    if (it_potion != NULL) {
+        pt_potion = it_potion->rtype->ptype;
+        if (pt_potion != NULL)
+            result = get_effect(self, pt_potion);
+    }
 
-  lua_pushinteger(L, result);
-  return 1;
+    lua_pushinteger(L, result);
+    return 1;
 }
 
 static int tolua_unit_add_item(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  const char *iname = tolua_tostring(L, 2, 0);
-  int number = (int)tolua_tonumber(L, 3, 0);
-  int result = -1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    const char *iname = tolua_tostring(L, 2, 0);
+    int number = (int)tolua_tonumber(L, 3, 0);
+    int result = -1;
 
-  if (iname != NULL) {
-    const item_type *itype = it_find(iname);
-    if (itype != NULL) {
-      item *i = i_change(&self->items, itype, number);
-      result = i ? i->number : 0;
+    if (iname != NULL) {
+        const item_type *itype = it_find(iname);
+        if (itype != NULL) {
+            item *i = i_change(&self->items, itype, number);
+            result = i ? i->number : 0;
+        }
     }
-  }
-  lua_pushinteger(L, result);
-  return 1;
+    lua_pushinteger(L, result);
+    return 1;
 }
 
 static int tolua_unit_getskill(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  const char *skname = tolua_tostring(L, 2, 0);
-  skill_t sk = findskill(skname);
-  int value = -1;
-  if (sk != NOSKILL) {
-    skill *sv = unit_skill(self, sk);
-    if (sv) {
-      value = sv->level;
-    } else
-      value = 0;
-  }
-  lua_pushinteger(L, value);
-  return 1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    const char *skname = tolua_tostring(L, 2, 0);
+    skill_t sk = findskill(skname);
+    int value = -1;
+    if (sk != NOSKILL) {
+        skill *sv = unit_skill(self, sk);
+        if (sv) {
+            value = sv->level;
+        }
+        else
+            value = 0;
+    }
+    lua_pushinteger(L, value);
+    return 1;
 }
 
 static int tolua_unit_effskill(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  const char *skname = tolua_tostring(L, 2, 0);
-  skill_t sk = findskill(skname);
-  int value = (sk == NOSKILL) ? -1 : eff_skill(self, sk, self->region);
-  lua_pushinteger(L, value);
-  return 1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    const char *skname = tolua_tostring(L, 2, 0);
+    skill_t sk = findskill(skname);
+    int value = (sk == NOSKILL) ? -1 : eff_skill(self, sk, self->region);
+    lua_pushinteger(L, value);
+    return 1;
 }
 
 typedef struct fctr_data {
-  unit *target;
-  int fhandle;
+    unit *target;
+    int fhandle;
 } fctr_data;
 
 typedef struct event {
-  struct event_arg *args;
-  char *msg;
+    struct event_arg *args;
+    char *msg;
 } event;
 
 int fctr_handle(struct trigger *tp, void *data)
 {
-  trigger *t = tp;
-  event evt = { 0 };
-  fctr_data *fd = (fctr_data *) t->data.v;
-  lua_State *L = (lua_State *) global.vm_state;
-  unit *u = fd->target;
+    trigger *t = tp;
+    event evt = { 0 };
+    fctr_data *fd = (fctr_data *)t->data.v;
+    lua_State *L = (lua_State *)global.vm_state;
+    unit *u = fd->target;
 
-  evt.args = (event_arg *) data;
-  lua_rawgeti(L, LUA_REGISTRYINDEX, fd->fhandle);
-  tolua_pushusertype(L, u, TOLUA_CAST "unit");
-  tolua_pushusertype(L, &evt, TOLUA_CAST "event");
-  if (lua_pcall(L, 2, 0, 0) != 0) {
-    const char *error = lua_tostring(L, -1);
-    log_error("event (%s): %s\n", unitname(u), error);
-    lua_pop(L, 1);
-    tolua_error(L, TOLUA_CAST "event handler call failed", NULL);
-  }
+    evt.args = (event_arg *)data;
+    lua_rawgeti(L, LUA_REGISTRYINDEX, fd->fhandle);
+    tolua_pushusertype(L, u, TOLUA_CAST "unit");
+    tolua_pushusertype(L, &evt, TOLUA_CAST "event");
+    if (lua_pcall(L, 2, 0, 0) != 0) {
+        const char *error = lua_tostring(L, -1);
+        log_error("event (%s): %s\n", unitname(u), error);
+        lua_pop(L, 1);
+        tolua_error(L, TOLUA_CAST "event handler call failed", NULL);
+    }
 
-  return 0;
+    return 0;
 }
 
 static void fctr_init(trigger * t)
 {
-  t->data.v = calloc(sizeof(fctr_data), 1);
+    t->data.v = calloc(sizeof(fctr_data), 1);
 }
 
 static void fctr_done(trigger * t)
 {
-  fctr_data *fd = (fctr_data *) t->data.v;
-  lua_State *L = (lua_State *) global.vm_state;
-  luaL_unref(L, LUA_REGISTRYINDEX, fd->fhandle);
-  free(fd);
+    fctr_data *fd = (fctr_data *)t->data.v;
+    lua_State *L = (lua_State *)global.vm_state;
+    luaL_unref(L, LUA_REGISTRYINDEX, fd->fhandle);
+    free(fd);
 }
 
 static struct trigger_type tt_lua = {
-  "lua_event",
-  fctr_init,
-  fctr_done,
-  fctr_handle
+    "lua_event",
+    fctr_init,
+    fctr_done,
+    fctr_handle
 };
 
 static trigger *trigger_lua(struct unit *u, int handle)
 {
-  trigger *t = t_new(&tt_lua);
-  fctr_data *td = (fctr_data *) t->data.v;
-  td->target = u;
-  td->fhandle = handle;
-  return t;
+    trigger *t = t_new(&tt_lua);
+    fctr_data *td = (fctr_data *)t->data.v;
+    td->target = u;
+    td->fhandle = handle;
+    return t;
 }
 
 static int tolua_unit_addhandler(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  const char *ename = tolua_tostring(L, 2, 0);
-  int handle;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    const char *ename = tolua_tostring(L, 2, 0);
+    int handle;
 
-  lua_pushvalue(L, 3);
-  handle = luaL_ref(L, LUA_REGISTRYINDEX);
-  add_trigger(&self->attribs, ename, trigger_lua(self, handle));
+    lua_pushvalue(L, 3);
+    handle = luaL_ref(L, LUA_REGISTRYINDEX);
+    add_trigger(&self->attribs, ename, trigger_lua(self, handle));
 
-  return 0;
+    return 0;
 }
 
 static int tolua_unit_addnotice(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  const char *str = tolua_tostring(L, 2, 0);
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    const char *str = tolua_tostring(L, 2, 0);
 
-  addmessage(self->region, self->faction, str, MSG_MESSAGE, ML_IMPORTANT);
-  return 0;
+    addmessage(self->region, self->faction, str, MSG_MESSAGE, ML_IMPORTANT);
+    return 0;
 }
 
 static void unit_castspell(unit * u, const char *name, int level)
 {
-  spell *sp = find_spell(name);
+    spell *sp = find_spell(name);
 
-  if (sp) {
-    spellbook *book = unit_get_spellbook(u);
-    if (spellbook_get(book, sp)) {
-      if (!sp->cast) {
-        log_error("spell '%s' has no function.\n", sp->sname);
-      } else {
-        castorder co;
-        create_castorder(&co, u, 0, sp, u->region, level, level * MagicPower(), 0, 0, 0);
-        sp->cast(&co);
-        free_castorder(&co);
-      }
+    if (sp) {
+        spellbook *book = unit_get_spellbook(u);
+        if (spellbook_get(book, sp)) {
+            if (!sp->cast) {
+                log_error("spell '%s' has no function.\n", sp->sname);
+            }
+            else {
+                castorder co;
+                create_castorder(&co, u, 0, sp, u->region, level, level * MagicPower(), 0, 0, 0);
+                sp->cast(&co);
+                free_castorder(&co);
+            }
+        }
     }
-  }
 }
 
 static int tolua_unit_castspell(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  const char *str = tolua_tostring(L, 2, 0);
-  int level = (int)tolua_tonumber(L, 3, 1);
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    const char *str = tolua_tostring(L, 2, 0);
+    int level = (int)tolua_tonumber(L, 3, 1);
 
-  unit_castspell(self, str, level);
-  return 0;
+    unit_castspell(self, str, level);
+    return 0;
 }
 
 static int tolua_unit_addspell(lua_State * L)
 {
-  unit *u = (unit *) tolua_tousertype(L, 1, 0);
-  const char *str = tolua_tostring(L, 2, 0);
-  int level = (int)tolua_tonumber(L, 3, 1);
-  int err = 0;
-  spell *sp = find_spell(str);
+    unit *u = (unit *)tolua_tousertype(L, 1, 0);
+    const char *str = tolua_tostring(L, 2, 0);
+    int level = (int)tolua_tonumber(L, 3, 1);
+    int err = 0;
+    spell *sp = find_spell(str);
 
-  if (!sp) {
-    log_error("spell %s could not be found\n", str);
-    return EINVAL;
-  } else {
-    unit_add_spell(u, 0, sp, level);
-  }
+    if (!sp) {
+        log_error("spell %s could not be found\n", str);
+        return EINVAL;
+    }
+    else {
+        unit_add_spell(u, 0, sp, level);
+    }
 
-  lua_pushinteger(L, err);
-  return 1;
+    lua_pushinteger(L, err);
+    return 1;
 }
 
 static int tolua_unit_set_racename(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  const char *str = tolua_tostring(L, 2, 0);
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    const char *str = tolua_tostring(L, 2, 0);
 
-  set_racename(&self->attribs, str);
-  return 0;
+    set_racename(&self->attribs, str);
+    return 0;
 }
 
 static int tolua_unit_get_racename(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  attrib *a = a_find(self->attribs, &at_racename);
-  if (a) {
-    tolua_pushstring(L, get_racename(a));
-    return 1;
-  }
-  return 0;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    attrib *a = a_find(self->attribs, &at_racename);
+    if (a) {
+        tolua_pushstring(L, get_racename(a));
+        return 1;
+    }
+    return 0;
 }
 
 static int tolua_unit_setskill(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  const char *skname = tolua_tostring(L, 2, 0);
-  int level = (int)tolua_tonumber(L, 3, 0);
-  skill_t sk = findskill(skname);
-  if (sk != NOSKILL) {
-    set_level(self, sk, level);
-  } else {
-    level = -1;
-  }
-  lua_pushinteger(L, level);
-  return 1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    const char *skname = tolua_tostring(L, 2, 0);
+    int level = (int)tolua_tonumber(L, 3, 0);
+    skill_t sk = findskill(skname);
+    if (sk != NOSKILL) {
+        set_level(self, sk, level);
+    }
+    else {
+        level = -1;
+    }
+    lua_pushinteger(L, level);
+    return 1;
 }
 
 static int tolua_unit_use_pooled(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  const char *iname = tolua_tostring(L, 2, 0);
-  int number = (int)tolua_tonumber(L, 3, 0);
-  const resource_type *rtype = rt_find(iname);
-  int result = -1;
-  if (rtype != NULL) {
-    result = use_pooled(self, rtype, GET_DEFAULT, number);
-  }
-  lua_pushinteger(L, result);
-  return 1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    const char *iname = tolua_tostring(L, 2, 0);
+    int number = (int)tolua_tonumber(L, 3, 0);
+    const resource_type *rtype = rt_find(iname);
+    int result = -1;
+    if (rtype != NULL) {
+        result = use_pooled(self, rtype, GET_DEFAULT, number);
+    }
+    lua_pushinteger(L, result);
+    return 1;
 }
 
 static int tolua_unit_get_pooled(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  const char *iname = tolua_tostring(L, 2, 0);
-  const resource_type *rtype = rt_find(iname);
-  int result = -1;
-  if (rtype != NULL) {
-    result = get_pooled(self, rtype, GET_DEFAULT, INT_MAX);
-  }
-  lua_pushinteger(L, result);
-  return 1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    const char *iname = tolua_tostring(L, 2, 0);
+    const resource_type *rtype = rt_find(iname);
+    int result = -1;
+    if (rtype != NULL) {
+        result = get_pooled(self, rtype, GET_DEFAULT, INT_MAX);
+    }
+    lua_pushinteger(L, result);
+    return 1;
 }
 
 static unit *unit_getfamiliar(const unit * u)
 {
-  attrib *a = a_find(u->attribs, &at_familiar);
-  if (a != NULL) {
-    return (unit *) a->data.v;
-  }
-  return NULL;
+    attrib *a = a_find(u->attribs, &at_familiar);
+    if (a != NULL) {
+        return (unit *)a->data.v;
+    }
+    return NULL;
 }
 
 static int tolua_unit_get_familiar(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  tolua_pushusertype(L, unit_getfamiliar(self), TOLUA_CAST "unit");
-  return 1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    tolua_pushusertype(L, unit_getfamiliar(self), TOLUA_CAST "unit");
+    return 1;
 }
 
 static int tolua_unit_set_familiar(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  create_newfamiliar(self, (unit *) tolua_tousertype(L, 2, 0));
-  return 0;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    create_newfamiliar(self, (unit *)tolua_tousertype(L, 2, 0));
+    return 0;
 }
 
 static int tolua_unit_get_building(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  tolua_pushusertype(L, self->building, TOLUA_CAST "building");
-  return 1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    tolua_pushusertype(L, self->building, TOLUA_CAST "building");
+    return 1;
 }
 
 static int tolua_unit_set_building(lua_State * L)
 {
-  unit *u = (unit *) tolua_tousertype(L, 1, 0);
-  if (u->faction) {
-    building * b = (building *) tolua_tousertype(L, 2, 0);
-    if (b!=u->building) {
-      leave(u, true);
-      if (b) {
-        if (u->region != b->region) {
-          move_unit(u, b->region, NULL);
+    unit *u = (unit *)tolua_tousertype(L, 1, 0);
+    if (u->faction) {
+        building * b = (building *)tolua_tousertype(L, 2, 0);
+        if (b != u->building) {
+            leave(u, true);
+            if (b) {
+                if (u->region != b->region) {
+                    move_unit(u, b->region, NULL);
+                }
+                u_set_building(u, b);
+            }
         }
-        u_set_building(u, b);
-      }
     }
-  }
-  return 0;
+    return 0;
 }
 
 static int tolua_unit_get_ship(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  tolua_pushusertype(L, self->ship, TOLUA_CAST "ship");
-  return 1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    tolua_pushusertype(L, self->ship, TOLUA_CAST "ship");
+    return 1;
 }
 
 static void unit_setship(unit * u, ship * s)
 {
-  leave(u, true);
-  if (s && u->region != s->region) {
-    move_unit(u, s->region, NULL);
-  }
-  u_set_ship(u, s);
+    leave(u, true);
+    if (s && u->region != s->region) {
+        move_unit(u, s->region, NULL);
+    }
+    u_set_ship(u, s);
 }
 
 static int tolua_unit_set_ship(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  if (self->faction) {
-    unit_setship(self, (ship *) tolua_tousertype(L, 2, 0));
-  }
-  return 0;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    if (self->faction) {
+        unit_setship(self, (ship *)tolua_tousertype(L, 2, 0));
+    }
+    return 0;
 }
 
 static int tolua_unit_get_region(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  tolua_pushusertype(L, self->region, TOLUA_CAST "region");
-  return 1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    tolua_pushusertype(L, self->region, TOLUA_CAST "region");
+    return 1;
 }
 
 static void unit_setregion(unit * u, region * r)
 {
-  move_unit(u, r, NULL);
+    move_unit(u, r, NULL);
 }
 
 static int tolua_unit_set_region(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  unit_setregion(self, (region *) tolua_tousertype(L, 2, 0));
-  return 0;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    unit_setregion(self, (region *)tolua_tousertype(L, 2, 0));
+    return 0;
 }
 
 static int tolua_unit_add_order(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  const char *str = tolua_tostring(L, 2, 0);
-  order *ord = parse_order(str, self->faction->locale);
-  unit_addorder(self, ord);
-  return 0;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    const char *str = tolua_tostring(L, 2, 0);
+    order *ord = parse_order(str, self->faction->locale);
+    unit_addorder(self, ord);
+    return 0;
 }
 
 static int tolua_unit_clear_orders(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  free_orders(&self->orders);
-  return 0;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    free_orders(&self->orders);
+    return 0;
 }
 
 static int tolua_unit_get_items(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
 
-  item **item_ptr = (item **) lua_newuserdata(L, sizeof(item *));
+    item **item_ptr = (item **)lua_newuserdata(L, sizeof(item *));
 
-  luaL_getmetatable(L, TOLUA_CAST "item");
-  lua_setmetatable(L, -2);
+    luaL_getmetatable(L, TOLUA_CAST "item");
+    lua_setmetatable(L, -2);
 
-  *item_ptr = self->items;
+    *item_ptr = self->items;
 
-  lua_pushcclosure(L, tolua_itemlist_next, 1);
+    lua_pushcclosure(L, tolua_itemlist_next, 1);
 
-  return 1;
+    return 1;
 }
 
 #ifdef TODO /* spellbooks */
 static int tolua_unit_get_spells(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  sc_mage *mage = get_mage(self);
-  quicklist *slist = 0;
+    unit *self = (unit *) tolua_tousertype(L, 1, 0);
+    sc_mage *mage = get_mage(self);
+    quicklist *slist = 0;
 
-  if (mage) {
-    quicklist **slist_ptr = get_spelllist(mage, self->faction);
-    if (slist_ptr) {
-      slist = *slist_ptr;
+    if (mage) {
+        quicklist **slist_ptr = get_spelllist(mage, self->faction);
+        if (slist_ptr) {
+            slist = *slist_ptr;
+        }
     }
-  }
 
-  return tolua_quicklist_push(L, "spell_list", "spell", slist);
+    return tolua_quicklist_push(L, "spell_list", "spell", slist);
 }
 
 static void unit_removespell(unit * u, spell * sp)
 {
-  quicklist **isptr;
+    quicklist **isptr;
 
-  isptr = get_spelllist(get_mage(u), u->faction);
-  ql_set_remove(isptr, sp);
+    isptr = get_spelllist(get_mage(u), u->faction);
+    ql_set_remove(isptr, sp);
 }
 
 static int tolua_unit_removespell(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  spell *sp = (spell *) tolua_tousertype(L, 2, 0);
-  unit_removespell(self, sp);
-  return 0;
+    unit *self = (unit *) tolua_tousertype(L, 1, 0);
+    spell *sp = (spell *) tolua_tousertype(L, 2, 0);
+    unit_removespell(self, sp);
+    return 0;
 }
 
 #endif
 
 static int tolua_unit_get_orders(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
 
-  order **order_ptr = (order **) lua_newuserdata(L, sizeof(order *));
+    order **order_ptr = (order **)lua_newuserdata(L, sizeof(order *));
 
-  luaL_getmetatable(L, TOLUA_CAST "order");
-  lua_setmetatable(L, -2);
+    luaL_getmetatable(L, TOLUA_CAST "order");
+    lua_setmetatable(L, -2);
 
-  *order_ptr = self->orders;
+    *order_ptr = self->orders;
 
-  lua_pushcclosure(L, tolua_orderlist_next, 1);
+    lua_pushcclosure(L, tolua_orderlist_next, 1);
 
-  return 1;
+    return 1;
 }
 
 static int tolua_unit_get_flag(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  const char *name = tolua_tostring(L, 2, 0);
-  int flag = atoi36(name);
-  attrib *a = find_key(self->attribs, flag);
-  lua_pushboolean(L, (a != NULL));
-  return 1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    const char *name = tolua_tostring(L, 2, 0);
+    int flag = atoi36(name);
+    attrib *a = find_key(self->attribs, flag);
+    lua_pushboolean(L, (a != NULL));
+    return 1;
 }
 
 static int tolua_unit_set_flag(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  const char *name = tolua_tostring(L, 2, 0);
-  int value = (int)tolua_tonumber(L, 3, 0);
-  int flag = atoi36(name);
-  attrib *a = find_key(self->attribs, flag);
-  if (a == NULL && value) {
-    add_key(&self->attribs, flag);
-  } else if (a != NULL && !value) {
-    a_remove(&self->attribs, a);
-  }
-  return 0;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    const char *name = tolua_tostring(L, 2, 0);
+    int value = (int)tolua_tonumber(L, 3, 0);
+    int flag = atoi36(name);
+    attrib *a = find_key(self->attribs, flag);
+    if (a == NULL && value) {
+        add_key(&self->attribs, flag);
+    }
+    else if (a != NULL && !value) {
+        a_remove(&self->attribs, a);
+    }
+    return 0;
 }
 
 static int tolua_unit_get_weight(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  lua_pushinteger(L, unit_getweight(self));
-  return 1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    lua_pushinteger(L, unit_getweight(self));
+    return 1;
 }
 
 static int tolua_unit_get_capacity(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  lua_pushinteger(L, unit_getcapacity(self));
-  return 1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    lua_pushinteger(L, unit_getcapacity(self));
+    return 1;
 }
 
 static int tolua_unit_get_faction(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  tolua_pushusertype(L, (void *)self->faction, TOLUA_CAST "faction");
-  return 1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    tolua_pushusertype(L, (void *)self->faction, TOLUA_CAST "faction");
+    return 1;
 }
 
 static int tolua_unit_set_faction(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  faction *f = (faction *) tolua_tousertype(L, 2, 0);
-  u_setfaction(self, f);
-  return 0;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    faction *f = (faction *)tolua_tousertype(L, 2, 0);
+    u_setfaction(self, f);
+    return 0;
 }
 
 static int tolua_unit_get_race(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  tolua_pushstring(L, u_race(self)->_name);
-  return 1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    tolua_pushstring(L, u_race(self)->_name);
+    return 1;
 }
 
 static int tolua_unit_set_race(lua_State * L)
 {
-    unit *self = (unit *) tolua_tousertype(L, 1, 0);
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
     const char *rcname = tolua_tostring(L, 2, 0);
     const race *rc = rc_find(rcname);
     if (rc != NULL) {
@@ -858,174 +868,177 @@ static int tolua_unit_set_race(lua_State * L)
 
 static int tolua_unit_destroy(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  if (self) {
-    remove_unit(&self->region->units, self);
-  }
-  return 0;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    if (self) {
+        remove_unit(&self->region->units, self);
+    }
+    return 0;
 }
 
 static int tolua_unit_create(lua_State * L)
 {
-  faction *f = (faction *) tolua_tousertype(L, 1, 0);
-  region *r = (region *) tolua_tousertype(L, 2, 0);
-  int num = (int)tolua_tonumber(L, 3, 1);
-  if (f && r) {
-    const race *rc = f->race;
-    const char *rcname = tolua_tostring(L, 4, NULL);
-    if (rcname)
-      rc = rc_find(rcname);
-    if (rc) {
-      unit *u = create_unit(r, f, num, rc, 0, NULL, NULL);
-      tolua_pushusertype(L, u, TOLUA_CAST "unit");
-      return 1;
+    faction *f = (faction *)tolua_tousertype(L, 1, 0);
+    region *r = (region *)tolua_tousertype(L, 2, 0);
+    int num = (int)tolua_tonumber(L, 3, 1);
+    if (f && r) {
+        const race *rc = f->race;
+        const char *rcname = tolua_tostring(L, 4, NULL);
+        if (rcname)
+            rc = rc_find(rcname);
+        if (rc) {
+            unit *u = create_unit(r, f, num, rc, 0, NULL, NULL);
+            tolua_pushusertype(L, u, TOLUA_CAST "unit");
+            return 1;
+        }
     }
-  }
-  return 0;
+    return 0;
 }
 
 static int tolua_unit_tostring(lua_State * L)
 {
-  unit *self = (unit *) tolua_tousertype(L, 1, 0);
-  lua_pushstring(L, unitname(self));
-  return 1;
+    unit *self = (unit *)tolua_tousertype(L, 1, 0);
+    lua_pushstring(L, unitname(self));
+    return 1;
 }
 
 static int tolua_event_gettype(lua_State * L)
 {
-  event *self = (event *) tolua_tousertype(L, 1, 0);
-  int index = (int)tolua_tonumber(L, 2, 0);
-  lua_pushstring(L, self->args[index].type);
-  return 1;
+    event *self = (event *)tolua_tousertype(L, 1, 0);
+    int index = (int)tolua_tonumber(L, 2, 0);
+    lua_pushstring(L, self->args[index].type);
+    return 1;
 }
 
 static int tolua_event_get(lua_State * L)
 {
-  struct event *self = (struct event *)tolua_tousertype(L, 1, 0);
-  int index = (int)tolua_tonumber(L, 2, 0);
+    struct event *self = (struct event *)tolua_tousertype(L, 1, 0);
+    int index = (int)tolua_tonumber(L, 2, 0);
 
-  event_arg *arg = self->args + index;
+    event_arg *arg = self->args + index;
 
-  if (arg->type) {
-    if (strcmp(arg->type, "string") == 0) {
-      tolua_pushstring(L, (const char *)arg->data.v);
-    } else if (strcmp(arg->type, "int") == 0) {
-      lua_pushinteger(L, arg->data.i);
-    } else if (strcmp(arg->type, "float") == 0) {
-      lua_pushnumber(L, (lua_Number) arg->data.f);
-    } else {
-      /* this is pretty lazy */
-      tolua_pushusertype(L, (void *)arg->data.v, TOLUA_CAST arg->type);
+    if (arg->type) {
+        if (strcmp(arg->type, "string") == 0) {
+            tolua_pushstring(L, (const char *)arg->data.v);
+        }
+        else if (strcmp(arg->type, "int") == 0) {
+            lua_pushinteger(L, arg->data.i);
+        }
+        else if (strcmp(arg->type, "float") == 0) {
+            lua_pushnumber(L, (lua_Number)arg->data.f);
+        }
+        else {
+            /* this is pretty lazy */
+            tolua_pushusertype(L, (void *)arg->data.v, TOLUA_CAST arg->type);
+        }
+        return 1;
     }
-    return 1;
-  }
-  tolua_error(L, TOLUA_CAST "invalid type argument for event", NULL);
-  return 0;
+    tolua_error(L, TOLUA_CAST "invalid type argument for event", NULL);
+    return 0;
 }
 
 void tolua_unit_open(lua_State * L)
 {
-  /* register user types */
-  tolua_usertype(L, TOLUA_CAST "unit");
+    /* register user types */
+    tolua_usertype(L, TOLUA_CAST "unit");
 
-  tolua_module(L, NULL, 0);
-  tolua_beginmodule(L, NULL);
-  {
-    tolua_cclass(L, TOLUA_CAST "event", TOLUA_CAST "event", TOLUA_CAST "",
-      NULL);
-    tolua_beginmodule(L, TOLUA_CAST "event");
+    tolua_module(L, NULL, 0);
+    tolua_beginmodule(L, NULL);
     {
-      tolua_function(L, TOLUA_CAST "get_type", &tolua_event_gettype);
-      tolua_function(L, TOLUA_CAST "get", &tolua_event_get);
-    }
-    tolua_endmodule(L);
+        tolua_cclass(L, TOLUA_CAST "event", TOLUA_CAST "event", TOLUA_CAST "",
+            NULL);
+        tolua_beginmodule(L, TOLUA_CAST "event");
+        {
+            tolua_function(L, TOLUA_CAST "get_type", &tolua_event_gettype);
+            tolua_function(L, TOLUA_CAST "get", &tolua_event_get);
+        }
+        tolua_endmodule(L);
 
-    tolua_cclass(L, TOLUA_CAST "unit", TOLUA_CAST "unit", TOLUA_CAST "", NULL);
-    tolua_beginmodule(L, TOLUA_CAST "unit");
-    {
-      tolua_function(L, TOLUA_CAST "__tostring", &tolua_unit_tostring);
-      tolua_function(L, TOLUA_CAST "create", &tolua_unit_create);
-      tolua_function(L, TOLUA_CAST "destroy", &tolua_unit_destroy);
+        tolua_cclass(L, TOLUA_CAST "unit", TOLUA_CAST "unit", TOLUA_CAST "", NULL);
+        tolua_beginmodule(L, TOLUA_CAST "unit");
+        {
+            tolua_function(L, TOLUA_CAST "__tostring", &tolua_unit_tostring);
+            tolua_function(L, TOLUA_CAST "create", &tolua_unit_create);
+            tolua_function(L, TOLUA_CAST "destroy", &tolua_unit_destroy);
 
-      tolua_variable(L, TOLUA_CAST "name", &tolua_unit_get_name,
-        tolua_unit_set_name);
-      tolua_variable(L, TOLUA_CAST "faction", &tolua_unit_get_faction,
-        tolua_unit_set_faction);
-      tolua_variable(L, TOLUA_CAST "id", tolua_unit_get_id, tolua_unit_set_id);
-      tolua_variable(L, TOLUA_CAST "group", tolua_unit_get_group, tolua_unit_set_group);
-      tolua_variable(L, TOLUA_CAST "info", tolua_unit_get_info, tolua_unit_set_info);
-      tolua_variable(L, TOLUA_CAST "hp", &tolua_unit_get_hp, tolua_unit_set_hp);
-      tolua_variable(L, TOLUA_CAST "status", &tolua_unit_get_status,
-        tolua_unit_set_status);
-      tolua_variable(L, TOLUA_CAST "familiar", &tolua_unit_get_familiar,
-        tolua_unit_set_familiar);
+            tolua_variable(L, TOLUA_CAST "name", &tolua_unit_get_name,
+                tolua_unit_set_name);
+            tolua_variable(L, TOLUA_CAST "faction", &tolua_unit_get_faction,
+                tolua_unit_set_faction);
+            tolua_variable(L, TOLUA_CAST "id", tolua_unit_get_id, tolua_unit_set_id);
+            tolua_variable(L, TOLUA_CAST "group", tolua_unit_get_group, tolua_unit_set_group);
+            tolua_variable(L, TOLUA_CAST "info", tolua_unit_get_info, tolua_unit_set_info);
+            tolua_variable(L, TOLUA_CAST "hp", &tolua_unit_get_hp, tolua_unit_set_hp);
+            tolua_variable(L, TOLUA_CAST "status", &tolua_unit_get_status,
+                tolua_unit_set_status);
+            tolua_variable(L, TOLUA_CAST "familiar", &tolua_unit_get_familiar,
+                tolua_unit_set_familiar);
 
-      tolua_variable(L, TOLUA_CAST "weight", &tolua_unit_get_weight, 0);
-      tolua_variable(L, TOLUA_CAST "capacity", &tolua_unit_get_capacity, 0);
+            tolua_variable(L, TOLUA_CAST "weight", &tolua_unit_get_weight, 0);
+            tolua_variable(L, TOLUA_CAST "capacity", &tolua_unit_get_capacity, 0);
 
-      tolua_function(L, TOLUA_CAST "add_order", &tolua_unit_add_order);
-      tolua_function(L, TOLUA_CAST "clear_orders", &tolua_unit_clear_orders);
-      tolua_variable(L, TOLUA_CAST "orders", &tolua_unit_get_orders, 0);
+            tolua_function(L, TOLUA_CAST "add_order", &tolua_unit_add_order);
+            tolua_function(L, TOLUA_CAST "clear_orders", &tolua_unit_clear_orders);
+            tolua_variable(L, TOLUA_CAST "orders", &tolua_unit_get_orders, 0);
 
-      /*  key-attributes for named flags: */
-      tolua_function(L, TOLUA_CAST "set_flag", &tolua_unit_set_flag);
-      tolua_function(L, TOLUA_CAST "get_flag", &tolua_unit_get_flag);
-      tolua_variable(L, TOLUA_CAST "flags", &tolua_unit_get_flags,
-        &tolua_unit_set_flags);
-      tolua_variable(L, TOLUA_CAST "age", &tolua_unit_get_age,
-        tolua_unit_set_age);
+            /*  key-attributes for named flags: */
+            tolua_function(L, TOLUA_CAST "set_flag", &tolua_unit_set_flag);
+            tolua_function(L, TOLUA_CAST "get_flag", &tolua_unit_get_flag);
+            tolua_variable(L, TOLUA_CAST "flags", &tolua_unit_get_flags,
+                &tolua_unit_set_flags);
+            tolua_variable(L, TOLUA_CAST "age", &tolua_unit_get_age,
+                tolua_unit_set_age);
 
-      /*  items: */
-      tolua_function(L, TOLUA_CAST "get_item", &tolua_unit_get_item);
-      tolua_function(L, TOLUA_CAST "add_item", &tolua_unit_add_item);
-      tolua_variable(L, TOLUA_CAST "items", &tolua_unit_get_items, 0);
-      tolua_function(L, TOLUA_CAST "get_pooled", &tolua_unit_get_pooled);
-      tolua_function(L, TOLUA_CAST "use_pooled", &tolua_unit_use_pooled);
+            /*  items: */
+            tolua_function(L, TOLUA_CAST "get_item", &tolua_unit_get_item);
+            tolua_function(L, TOLUA_CAST "add_item", &tolua_unit_add_item);
+            tolua_variable(L, TOLUA_CAST "items", &tolua_unit_get_items, 0);
+            tolua_function(L, TOLUA_CAST "get_pooled", &tolua_unit_get_pooled);
+            tolua_function(L, TOLUA_CAST "use_pooled", &tolua_unit_use_pooled);
 
-      /* effects */
-      tolua_function(L, TOLUA_CAST "get_potion", &tolua_unit_get_effect);
+            /* effects */
+            tolua_function(L, TOLUA_CAST "get_potion", &tolua_unit_get_effect);
 
-      /*  skills: */
-      tolua_function(L, TOLUA_CAST "get_skill", &tolua_unit_getskill);
-      tolua_function(L, TOLUA_CAST "eff_skill", &tolua_unit_effskill);
-      tolua_function(L, TOLUA_CAST "set_skill", &tolua_unit_setskill);
+            /*  skills: */
+            tolua_function(L, TOLUA_CAST "get_skill", &tolua_unit_getskill);
+            tolua_function(L, TOLUA_CAST "eff_skill", &tolua_unit_effskill);
+            tolua_function(L, TOLUA_CAST "set_skill", &tolua_unit_setskill);
 
-      tolua_function(L, TOLUA_CAST "add_notice", &tolua_unit_addnotice);
+            tolua_function(L, TOLUA_CAST "add_notice", &tolua_unit_addnotice);
 
-      /*  npc logic: */
-      tolua_function(L, TOLUA_CAST "add_handler", &tolua_unit_addhandler);
+            /*  npc logic: */
+            tolua_function(L, TOLUA_CAST "add_handler", &tolua_unit_addhandler);
 
-      tolua_variable(L, TOLUA_CAST "race_name", &tolua_unit_get_racename,
-        &tolua_unit_set_racename);
-      tolua_function(L, TOLUA_CAST "add_spell", &tolua_unit_addspell);
+            tolua_variable(L, TOLUA_CAST "race_name", &tolua_unit_get_racename,
+                &tolua_unit_set_racename);
+            tolua_function(L, TOLUA_CAST "add_spell", &tolua_unit_addspell);
 #ifdef TODO /* spellbooks */
-      tolua_function(L, TOLUA_CAST "remove_spell", &tolua_unit_removespell);
-      tolua_variable(L, TOLUA_CAST "spells", &tolua_unit_get_spells, 0);
+            tolua_function(L, TOLUA_CAST "remove_spell", &tolua_unit_removespell);
+            tolua_variable(L, TOLUA_CAST "spells", &tolua_unit_get_spells, 0);
 #endif
-      tolua_function(L, TOLUA_CAST "cast_spell", &tolua_unit_castspell);
+            tolua_function(L, TOLUA_CAST "cast_spell", &tolua_unit_castspell);
 
-      tolua_variable(L, TOLUA_CAST "magic", &tolua_unit_get_magic,
-        tolua_unit_set_magic);
-      tolua_variable(L, TOLUA_CAST "aura", &tolua_unit_get_aura,
-        tolua_unit_set_aura);
-      tolua_variable(L, TOLUA_CAST "building", &tolua_unit_get_building,
-        tolua_unit_set_building);
-      tolua_variable(L, TOLUA_CAST "ship", &tolua_unit_get_ship,
-        tolua_unit_set_ship);
-      tolua_variable(L, TOLUA_CAST "region", &tolua_unit_get_region,
-        tolua_unit_set_region);
-      tolua_variable(L, TOLUA_CAST "number", &tolua_unit_get_number,
-        tolua_unit_set_number);
-      tolua_variable(L, TOLUA_CAST "race", &tolua_unit_get_race,
-        tolua_unit_set_race);
-      tolua_variable(L, TOLUA_CAST "hp_max", &tolua_unit_get_hpmax, 0);
+            tolua_variable(L, TOLUA_CAST "magic", &tolua_unit_get_magic,
+                tolua_unit_set_magic);
+            tolua_variable(L, TOLUA_CAST "aura", &tolua_unit_get_aura,
+                tolua_unit_set_aura);
+            tolua_variable(L, TOLUA_CAST "building", &tolua_unit_get_building,
+                tolua_unit_set_building);
+            tolua_variable(L, TOLUA_CAST "ship", &tolua_unit_get_ship,
+                tolua_unit_set_ship);
+            tolua_variable(L, TOLUA_CAST "region", &tolua_unit_get_region,
+                tolua_unit_set_region);
+            tolua_variable(L, TOLUA_CAST "number", &tolua_unit_get_number,
+                tolua_unit_set_number);
+            tolua_variable(L, TOLUA_CAST "race", &tolua_unit_get_race,
+                tolua_unit_set_race);
+            tolua_variable(L, TOLUA_CAST "hp_max", &tolua_unit_get_hpmax, 0);
 
-      tolua_variable(L, TOLUA_CAST "objects", &tolua_unit_get_objects, 0);
+            tolua_variable(L, TOLUA_CAST "objects", &tolua_unit_get_objects, 0);
 #ifdef BSON_ATTRIB
-      tolua_variable(L, TOLUA_CAST "attribs", &tolua_unit_get_attribs, 0);
+            tolua_variable(L, TOLUA_CAST "attribs", &tolua_unit_get_attribs, 0);
 #endif
+        }
+        tolua_endmodule(L);
     }
     tolua_endmodule(L);
-  }
-  tolua_endmodule(L);
 }
diff --git a/src/bind_unit.h b/src/bind_unit.h
index 767f4bfd6..cc29bfa61 100644
--- a/src/bind_unit.h
+++ b/src/bind_unit.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
 +-------------------+
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Christian Schlittchen <corwin@amber.kn-bremen.de>
diff --git a/src/bindings.c b/src/bindings.c
index d6b29ddb5..0385506cf 100755
--- a/src/bindings.c
+++ b/src/bindings.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
 +-------------------+
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Christian Schlittchen <corwin@amber.kn-bremen.de>
@@ -92,585 +92,590 @@ TOLUA_PKG(game);
 
 int log_lua_error(lua_State * L)
 {
-  const char *error = lua_tostring(L, -1);
-  log_error("LUA call failed.\n%s\n", error);
-  lua_pop(L, 1);
-  return 1;
+    const char *error = lua_tostring(L, -1);
+    log_error("LUA call failed.\n%s\n", error);
+    lua_pop(L, 1);
+    return 1;
 }
 
 int tolua_orderlist_next(lua_State * L)
 {
-  order **order_ptr = (order **) lua_touserdata(L, lua_upvalueindex(1));
-  order *ord = *order_ptr;
-  if (ord != NULL) {
-    char cmd[8192];
-    write_order(ord, cmd, sizeof(cmd));
-    tolua_pushstring(L, cmd);
-    *order_ptr = ord->next;
-    return 1;
-  }
-  return 0;
+    order **order_ptr = (order **)lua_touserdata(L, lua_upvalueindex(1));
+    order *ord = *order_ptr;
+    if (ord != NULL) {
+        char cmd[8192];
+        write_order(ord, cmd, sizeof(cmd));
+        tolua_pushstring(L, cmd);
+        *order_ptr = ord->next;
+        return 1;
+    }
+    return 0;
 }
 
 static int tolua_quicklist_iter(lua_State * L)
 {
-  quicklist **qlp = (quicklist **) lua_touserdata(L, lua_upvalueindex(1));
-  quicklist *ql = *qlp;
-  if (ql != NULL) {
-    int index = lua_tointeger(L, lua_upvalueindex(2));
-    const char *type = lua_tostring(L, lua_upvalueindex(3));
-    void *data = ql_get(ql, index);
-    tolua_pushusertype(L, data, TOLUA_CAST type);
-    ql_advance(qlp, &index, 1);
-    tolua_pushnumber(L, index);
-    lua_replace(L, lua_upvalueindex(2));
-    return 1;
-  }
-  return 0;
+    quicklist **qlp = (quicklist **)lua_touserdata(L, lua_upvalueindex(1));
+    quicklist *ql = *qlp;
+    if (ql != NULL) {
+        int index = lua_tointeger(L, lua_upvalueindex(2));
+        const char *type = lua_tostring(L, lua_upvalueindex(3));
+        void *data = ql_get(ql, index);
+        tolua_pushusertype(L, data, TOLUA_CAST type);
+        ql_advance(qlp, &index, 1);
+        tolua_pushnumber(L, index);
+        lua_replace(L, lua_upvalueindex(2));
+        return 1;
+    }
+    return 0;
 }
 
 int tolua_quicklist_push(struct lua_State *L, const char *list_type,
-  const char *elem_type, struct quicklist *list)
+    const char *elem_type, struct quicklist *list)
 {
-  if (list) {
-    quicklist **qlist_ptr =
-      (quicklist **) lua_newuserdata(L, sizeof(quicklist *));
-    *qlist_ptr = list;
-    luaL_getmetatable(L, list_type);
-    lua_setmetatable(L, -2);
-    lua_pushnumber(L, 0);
-    lua_pushstring(L, elem_type);
-    lua_pushcclosure(L, tolua_quicklist_iter, 3);       /* OBS: this closure has multiple upvalues (list, index, type_name) */
-  } else {
-    lua_pushnil(L);
-  }
-  return 1;
+    if (list) {
+        quicklist **qlist_ptr =
+            (quicklist **)lua_newuserdata(L, sizeof(quicklist *));
+        *qlist_ptr = list;
+        luaL_getmetatable(L, list_type);
+        lua_setmetatable(L, -2);
+        lua_pushnumber(L, 0);
+        lua_pushstring(L, elem_type);
+        lua_pushcclosure(L, tolua_quicklist_iter, 3);       /* OBS: this closure has multiple upvalues (list, index, type_name) */
+    }
+    else {
+        lua_pushnil(L);
+    }
+    return 1;
 }
 
 int tolua_itemlist_next(lua_State * L)
 {
-  item **item_ptr = (item **) lua_touserdata(L, lua_upvalueindex(1));
-  item *itm = *item_ptr;
-  if (itm != NULL) {
-    tolua_pushstring(L, itm->type->rtype->_name);
-    *item_ptr = itm->next;
-    return 1;
-  }
-  return 0;
+    item **item_ptr = (item **)lua_touserdata(L, lua_upvalueindex(1));
+    item *itm = *item_ptr;
+    if (itm != NULL) {
+        tolua_pushstring(L, itm->type->rtype->_name);
+        *item_ptr = itm->next;
+        return 1;
+    }
+    return 0;
 }
 
 static int tolua_autoseed(lua_State * L)
 {
-  const char *filename = tolua_tostring(L, 1, 0);
-  int new_island = tolua_toboolean(L, 2, 0);
-  newfaction *players = read_newfactions(filename);
-  if (players != NULL) {
-    while (players) {
-      int n = listlen(players);
-      int k = (n + ISLANDSIZE - 1) / ISLANDSIZE;
-      k = n / k;
-      n = autoseed(&players, k, new_island ? 0 : TURNS_PER_ISLAND);
-      if (n == 0) {
-        break;
-      }
+    const char *filename = tolua_tostring(L, 1, 0);
+    int new_island = tolua_toboolean(L, 2, 0);
+    newfaction *players = read_newfactions(filename);
+    if (players != NULL) {
+        while (players) {
+            int n = listlen(players);
+            int k = (n + ISLANDSIZE - 1) / ISLANDSIZE;
+            k = n / k;
+            n = autoseed(&players, k, new_island ? 0 : TURNS_PER_ISLAND);
+            if (n == 0) {
+                break;
+            }
+        }
     }
-  }
-  return 0;
+    return 0;
 }
 
 static int tolua_getkey(lua_State * L)
 {
-  const char *name = tolua_tostring(L, 1, 0);
-  int flag = atoi36(name);
-  attrib *a = find_key(global.attribs, flag);
-  lua_pushboolean(L, a != NULL);
-  return 1;
+    const char *name = tolua_tostring(L, 1, 0);
+    int flag = atoi36(name);
+    attrib *a = find_key(global.attribs, flag);
+    lua_pushboolean(L, a != NULL);
+    return 1;
 }
 
 static int tolua_translate(lua_State * L)
 {
-  const char *str = tolua_tostring(L, 1, 0);
-  const char *lang = tolua_tostring(L, 2, 0);
-  struct locale *loc = lang ? get_locale(lang) : default_locale;
-  if (loc) {
-    str = LOC(loc, str);
-    tolua_pushstring(L, str);
-    return 1;
-  }
-  return 0;
+    const char *str = tolua_tostring(L, 1, 0);
+    const char *lang = tolua_tostring(L, 2, 0);
+    struct locale *loc = lang ? get_locale(lang) : default_locale;
+    if (loc) {
+        str = LOC(loc, str);
+        tolua_pushstring(L, str);
+        return 1;
+    }
+    return 0;
 }
 
 static int tolua_setkey(lua_State * L)
 {
-  const char *name = tolua_tostring(L, 1, 0);
-  int value = tolua_toboolean(L, 2, 0);
-  int flag = atoi36(name);
-  attrib *a = find_key(global.attribs, flag);
-  if (a == NULL && value) {
-    add_key(&global.attribs, flag);
-  } else if (a != NULL && !value) {
-    a_remove(&global.attribs, a);
-  }
-  return 0;
+    const char *name = tolua_tostring(L, 1, 0);
+    int value = tolua_toboolean(L, 2, 0);
+    int flag = atoi36(name);
+    attrib *a = find_key(global.attribs, flag);
+    if (a == NULL && value) {
+        add_key(&global.attribs, flag);
+    }
+    else if (a != NULL && !value) {
+        a_remove(&global.attribs, a);
+    }
+    return 0;
 }
 
 static int tolua_rng_int(lua_State * L)
 {
-  lua_pushnumber(L, (lua_Number) rng_int());
-  return 1;
+    lua_pushnumber(L, (lua_Number)rng_int());
+    return 1;
 }
 
 static int tolua_read_orders(lua_State * L)
 {
-  const char *filename = tolua_tostring(L, 1, 0);
-  int result = readorders(filename);
-  lua_pushnumber(L, (lua_Number) result);
-  return 1;
+    const char *filename = tolua_tostring(L, 1, 0);
+    int result = readorders(filename);
+    lua_pushnumber(L, (lua_Number)result);
+    return 1;
 }
 
 static int tolua_message_unit(lua_State * L)
 {
-  unit *sender = (unit *) tolua_tousertype(L, 1, 0);
-  unit *target = (unit *) tolua_tousertype(L, 2, 0);
-  const char *str = tolua_tostring(L, 3, 0);
-  if (!target)
-    tolua_error(L, TOLUA_CAST "target is nil", NULL);
-  if (!sender)
-    tolua_error(L, TOLUA_CAST "sender is nil", NULL);
-  deliverMail(target->faction, sender->region, sender, str, target);
-  return 0;
+    unit *sender = (unit *)tolua_tousertype(L, 1, 0);
+    unit *target = (unit *)tolua_tousertype(L, 2, 0);
+    const char *str = tolua_tostring(L, 3, 0);
+    if (!target)
+        tolua_error(L, TOLUA_CAST "target is nil", NULL);
+    if (!sender)
+        tolua_error(L, TOLUA_CAST "sender is nil", NULL);
+    deliverMail(target->faction, sender->region, sender, str, target);
+    return 0;
 }
 
 static int tolua_message_faction(lua_State * L)
 {
-  unit *sender = (unit *) tolua_tousertype(L, 1, 0);
-  faction *target = (faction *) tolua_tousertype(L, 2, 0);
-  const char *str = tolua_tostring(L, 3, 0);
-  if (!target)
-    tolua_error(L, TOLUA_CAST "target is nil", NULL);
-  if (!sender)
-    tolua_error(L, TOLUA_CAST "sender is nil", NULL);
-  deliverMail(target, sender->region, sender, str, NULL);
-  return 0;
+    unit *sender = (unit *)tolua_tousertype(L, 1, 0);
+    faction *target = (faction *)tolua_tousertype(L, 2, 0);
+    const char *str = tolua_tostring(L, 3, 0);
+    if (!target)
+        tolua_error(L, TOLUA_CAST "target is nil", NULL);
+    if (!sender)
+        tolua_error(L, TOLUA_CAST "sender is nil", NULL);
+    deliverMail(target, sender->region, sender, str, NULL);
+    return 0;
 }
 
 static int tolua_message_region(lua_State * L)
 {
-  unit *sender = (unit *) tolua_tousertype(L, 1, 0);
-  const char *str = tolua_tostring(L, 2, 0);
-  if (!sender)
-    tolua_error(L, TOLUA_CAST "sender is nil", NULL);
-  ADDMSG(&sender->region->msgs, msg_message("mail_result", "unit message",
-      sender, str));
-  return 0;
+    unit *sender = (unit *)tolua_tousertype(L, 1, 0);
+    const char *str = tolua_tostring(L, 2, 0);
+    if (!sender)
+        tolua_error(L, TOLUA_CAST "sender is nil", NULL);
+    ADDMSG(&sender->region->msgs, msg_message("mail_result", "unit message",
+        sender, str));
+    return 0;
 }
 
 static int tolua_update_guards(lua_State * L)
 {
-  update_guards();
-  return 0;
+    update_guards();
+    return 0;
 }
 
 static int tolua_set_turn(lua_State * L)
 {
-  turn = (int)tolua_tonumber(L, 1, 0);
-  return 0;
+    turn = (int)tolua_tonumber(L, 1, 0);
+    return 0;
 }
 
 static int tolua_get_turn(lua_State * L)
 {
-  tolua_pushnumber(L, (lua_Number) turn);
-  return 1;
+    tolua_pushnumber(L, (lua_Number)turn);
+    return 1;
 }
 
 static int tolua_atoi36(lua_State * L)
 {
-  const char *s = tolua_tostring(L, 1, 0);
-  tolua_pushnumber(L, (lua_Number) atoi36(s));
-  return 1;
+    const char *s = tolua_tostring(L, 1, 0);
+    tolua_pushnumber(L, (lua_Number)atoi36(s));
+    return 1;
 }
 
 static int tolua_itoa36(lua_State * L)
 {
-  int i = (int)tolua_tonumber(L, 1, 0);
-  tolua_pushstring(L, itoa36(i));
-  return 1;
+    int i = (int)tolua_tonumber(L, 1, 0);
+    tolua_pushstring(L, itoa36(i));
+    return 1;
 }
 
 static int tolua_dice_rand(lua_State * L)
 {
-  const char *s = tolua_tostring(L, 1, 0);
-  tolua_pushnumber(L, dice_rand(s));
-  return 1;
+    const char *s = tolua_tostring(L, 1, 0);
+    tolua_pushnumber(L, dice_rand(s));
+    return 1;
 }
 
 static int tolua_addequipment(lua_State * L)
 {
-  const char *eqname = tolua_tostring(L, 1, 0);
-  const char *iname = tolua_tostring(L, 2, 0);
-  const char *value = tolua_tostring(L, 3, 0);
-  int result = -1;
-  if (iname != NULL) {
-    const struct item_type *itype = it_find(iname);
-    if (itype != NULL) {
-      equipment_setitem(create_equipment(eqname), itype, value);
-      result = 0;
+    const char *eqname = tolua_tostring(L, 1, 0);
+    const char *iname = tolua_tostring(L, 2, 0);
+    const char *value = tolua_tostring(L, 3, 0);
+    int result = -1;
+    if (iname != NULL) {
+        const struct item_type *itype = it_find(iname);
+        if (itype != NULL) {
+            equipment_setitem(create_equipment(eqname), itype, value);
+            result = 0;
+        }
     }
-  }
-  lua_pushnumber(L, (lua_Number) result);
-  return 1;
+    lua_pushnumber(L, (lua_Number)result);
+    return 1;
 }
 
 static int tolua_get_season(lua_State * L)
 {
-  int turnno = (int)tolua_tonumber(L, 1, 0);
-  gamedate gd;
-  get_gamedate(turnno, &gd);
-  tolua_pushstring(L, seasonnames[gd.season]);
-  return 1;
+    int turnno = (int)tolua_tonumber(L, 1, 0);
+    gamedate gd;
+    get_gamedate(turnno, &gd);
+    tolua_pushstring(L, seasonnames[gd.season]);
+    return 1;
 }
 
 static int tolua_create_curse(lua_State * L)
 {
-  unit *u = (unit *) tolua_tousertype(L, 1, 0);
-  tolua_Error tolua_err;
-  attrib **ap = NULL;
-  if (tolua_isusertype(L, 2, TOLUA_CAST "unit", 0, &tolua_err)) {
-    unit *target = (unit *) tolua_tousertype(L, 2, 0);
-    if (target)
-      ap = &target->attribs;
-  } else if (tolua_isusertype(L, 2, TOLUA_CAST "region", 0, &tolua_err)) {
-    region *target = (region *) tolua_tousertype(L, 2, 0);
-    if (target)
-      ap = &target->attribs;
-  } else if (tolua_isusertype(L, 2, TOLUA_CAST "ship", 0, &tolua_err)) {
-    ship *target = (ship *) tolua_tousertype(L, 2, 0);
-    if (target)
-      ap = &target->attribs;
-  } else if (tolua_isusertype(L, 2, TOLUA_CAST "building", 0, &tolua_err)) {
-    building *target = (building *) tolua_tousertype(L, 2, 0);
-    if (target)
-      ap = &target->attribs;
-  }
-  if (ap) {
-    const char *cname = tolua_tostring(L, 3, 0);
-    const curse_type *ctype = ct_find(cname);
-    if (ctype) {
-      float vigour = (float)tolua_tonumber(L, 4, 0);
-      int duration = (int)tolua_tonumber(L, 5, 0);
-      float effect = (float)tolua_tonumber(L, 6, 0);
-      int men = (int)tolua_tonumber(L, 7, 0);   /* optional */
-      curse *c = create_curse(u, ap, ctype, vigour, duration, effect, men);
-      if (c) {
-        tolua_pushboolean(L, true);
-        return 1;
-      }
+    unit *u = (unit *)tolua_tousertype(L, 1, 0);
+    tolua_Error tolua_err;
+    attrib **ap = NULL;
+    if (tolua_isusertype(L, 2, TOLUA_CAST "unit", 0, &tolua_err)) {
+        unit *target = (unit *)tolua_tousertype(L, 2, 0);
+        if (target)
+            ap = &target->attribs;
     }
-  }
-  tolua_pushboolean(L, false);
-  return 1;
+    else if (tolua_isusertype(L, 2, TOLUA_CAST "region", 0, &tolua_err)) {
+        region *target = (region *)tolua_tousertype(L, 2, 0);
+        if (target)
+            ap = &target->attribs;
+    }
+    else if (tolua_isusertype(L, 2, TOLUA_CAST "ship", 0, &tolua_err)) {
+        ship *target = (ship *)tolua_tousertype(L, 2, 0);
+        if (target)
+            ap = &target->attribs;
+    }
+    else if (tolua_isusertype(L, 2, TOLUA_CAST "building", 0, &tolua_err)) {
+        building *target = (building *)tolua_tousertype(L, 2, 0);
+        if (target)
+            ap = &target->attribs;
+    }
+    if (ap) {
+        const char *cname = tolua_tostring(L, 3, 0);
+        const curse_type *ctype = ct_find(cname);
+        if (ctype) {
+            float vigour = (float)tolua_tonumber(L, 4, 0);
+            int duration = (int)tolua_tonumber(L, 5, 0);
+            float effect = (float)tolua_tonumber(L, 6, 0);
+            int men = (int)tolua_tonumber(L, 7, 0);   /* optional */
+            curse *c = create_curse(u, ap, ctype, vigour, duration, effect, men);
+            if (c) {
+                tolua_pushboolean(L, true);
+                return 1;
+            }
+        }
+    }
+    tolua_pushboolean(L, false);
+    return 1;
 }
 
 static int tolua_learn_skill(lua_State * L)
 {
-  unit *u = (unit *) tolua_tousertype(L, 1, 0);
-  const char *skname = tolua_tostring(L, 2, 0);
-  float chances = (float)tolua_tonumber(L, 3, 0);
-  skill_t sk = findskill(skname);
-  if (sk != NOSKILL) {
-    learn_skill(u, sk, chances);
-  }
-  return 0;
+    unit *u = (unit *)tolua_tousertype(L, 1, 0);
+    const char *skname = tolua_tostring(L, 2, 0);
+    float chances = (float)tolua_tonumber(L, 3, 0);
+    skill_t sk = findskill(skname);
+    if (sk != NOSKILL) {
+        learn_skill(u, sk, chances);
+    }
+    return 0;
 }
 
 static int tolua_update_scores(lua_State * L)
 {
-  score();
-  return 0;
+    score();
+    return 0;
 }
 
 static int tolua_update_owners(lua_State * L)
 {
-  region *r;
-  for (r = regions; r; r = r->next) {
-    update_owners(r);
-  }
-  return 0;
+    region *r;
+    for (r = regions; r; r = r->next) {
+        update_owners(r);
+    }
+    return 0;
 }
 
 static int tolua_update_subscriptions(lua_State * L)
 {
-  update_subscriptions();
-  return 0;
+    update_subscriptions();
+    return 0;
 }
 
 static int tolua_remove_empty_units(lua_State * L)
 {
-  remove_empty_units();
-  return 0;
+    remove_empty_units();
+    return 0;
 }
 
 static int tolua_get_nmrs(lua_State * L)
 {
-  int result = -1;
-  int n = (int)tolua_tonumber(L, 1, 0);
-  if (n >= 0 && n <= NMRTimeout()) {
-    if (nmrs == NULL) {
-      update_nmrs();
+    int result = -1;
+    int n = (int)tolua_tonumber(L, 1, 0);
+    if (n >= 0 && n <= NMRTimeout()) {
+        if (nmrs == NULL) {
+            update_nmrs();
+        }
+        result = nmrs[n];
     }
-    result = nmrs[n];
-  }
-  tolua_pushnumber(L, (lua_Number) result);
-  return 1;
+    tolua_pushnumber(L, (lua_Number)result);
+    return 1;
 }
 
 static int tolua_equipunit(lua_State * L)
 {
-  unit *u = (unit *) tolua_tousertype(L, 1, 0);
-  const char *eqname = tolua_tostring(L, 2, 0);
-  equip_unit(u, get_equipment(eqname));
-  return 0;
+    unit *u = (unit *)tolua_tousertype(L, 1, 0);
+    const char *eqname = tolua_tostring(L, 2, 0);
+    equip_unit(u, get_equipment(eqname));
+    return 0;
 }
 
 static int tolua_equipment_setitem(lua_State * L)
 {
-  int result = -1;
-  const char *eqname = tolua_tostring(L, 1, 0);
-  const char *iname = tolua_tostring(L, 2, 0);
-  const char *value = tolua_tostring(L, 3, 0);
-  if (iname != NULL) {
-    const struct item_type *itype = it_find(iname);
-    if (itype != NULL) {
-      equipment_setitem(create_equipment(eqname), itype, value);
-      result = 0;
+    int result = -1;
+    const char *eqname = tolua_tostring(L, 1, 0);
+    const char *iname = tolua_tostring(L, 2, 0);
+    const char *value = tolua_tostring(L, 3, 0);
+    if (iname != NULL) {
+        const struct item_type *itype = it_find(iname);
+        if (itype != NULL) {
+            equipment_setitem(create_equipment(eqname), itype, value);
+            result = 0;
+        }
     }
-  }
-  tolua_pushnumber(L, (lua_Number) result);
-  return 1;
+    tolua_pushnumber(L, (lua_Number)result);
+    return 1;
 }
 
 static int tolua_spawn_braineaters(lua_State * L)
 {
-  float chance = (float)tolua_tonumber(L, 1, 0);
-  spawn_braineaters(chance);
-  return 0;
+    float chance = (float)tolua_tonumber(L, 1, 0);
+    spawn_braineaters(chance);
+    return 0;
 }
 
 static int tolua_init_reports(lua_State * L)
 {
-  int result = init_reports();
-  tolua_pushnumber(L, (lua_Number) result);
-  return 1;
+    int result = init_reports();
+    tolua_pushnumber(L, (lua_Number)result);
+    return 1;
 }
 
 static int tolua_write_report(lua_State * L)
 {
-  faction *f = (faction *) tolua_tousertype(L, 1, 0);
-  if (f) {
-      time_t ltime = time(0);
-      int result = write_reports(f, ltime);
-      tolua_pushnumber(L, (lua_Number)result);
-  }
-  else {
-      tolua_pushstring(L, "function expects a faction, got nil");
-  }
-  return 1;
+    faction *f = (faction *)tolua_tousertype(L, 1, 0);
+    if (f) {
+        time_t ltime = time(0);
+        int result = write_reports(f, ltime);
+        tolua_pushnumber(L, (lua_Number)result);
+    }
+    else {
+        tolua_pushstring(L, "function expects a faction, got nil");
+    }
+    return 1;
 }
 
 static int tolua_write_reports(lua_State * L)
 {
-  int result;
-  init_reports();
-  result = reports();
-  tolua_pushnumber(L, (lua_Number) result);
-  return 1;
+    int result;
+    init_reports();
+    result = reports();
+    tolua_pushnumber(L, (lua_Number)result);
+    return 1;
 }
 
 static void reset_game(void)
 {
-  region *r;
-  faction *f;
-  for (r = regions; r; r = r->next) {
-    unit *u;
-    building *b;
-    r->flags &= RF_SAVEMASK;
-    for (u = r->units; u; u = u->next) {
-      u->flags &= UFL_SAVEMASK;
+    region *r;
+    faction *f;
+    for (r = regions; r; r = r->next) {
+        unit *u;
+        building *b;
+        r->flags &= RF_SAVEMASK;
+        for (u = r->units; u; u = u->next) {
+            u->flags &= UFL_SAVEMASK;
+        }
+        for (b = r->buildings; b; b = b->next) {
+            b->flags &= BLD_SAVEMASK;
+        }
+        if (r->land && r->land->ownership && r->land->ownership->owner) {
+            faction *owner = r->land->ownership->owner;
+            if (owner == get_monsters()) {
+                /* some compat-fix, i believe. */
+                owner = update_owners(r);
+            }
+            if (owner) {
+                fset(r, RF_GUARDED);
+            }
+        }
     }
-    for (b = r->buildings; b; b = b->next) {
-      b->flags &= BLD_SAVEMASK;
+    for (f = factions; f; f = f->next) {
+        f->flags &= FFL_SAVEMASK;
     }
-    if (r->land && r->land->ownership && r->land->ownership->owner) {
-      faction *owner = r->land->ownership->owner;
-      if (owner == get_monsters()) {
-        /* some compat-fix, i believe. */
-        owner = update_owners(r);
-      }
-      if (owner) {
-        fset(r, RF_GUARDED);
-      }
-    }
-  }
-  for (f = factions; f; f = f->next) {
-    f->flags &= FFL_SAVEMASK;
-  }
-  init_locales();
+    init_locales();
 }
 
 static int tolua_process_orders(lua_State * L)
 {
-  ++turn;
-  reset_game();
-  processorders();
-  return 0;
+    ++turn;
+    reset_game();
+    processorders();
+    return 0;
 }
 
 static int tolua_write_passwords(lua_State * L)
 {
-  int result = writepasswd();
-  lua_pushnumber(L, (lua_Number) result);
-  return 0;
+    int result = writepasswd();
+    lua_pushnumber(L, (lua_Number)result);
+    return 0;
 }
 
 static struct summary *sum_begin = 0;
 static int tolua_init_summary(lua_State * L)
 {
-  sum_begin = make_summary();
-  return 0;
+    sum_begin = make_summary();
+    return 0;
 }
 
 static int tolua_write_summary(lua_State * L)
 {
-  if (sum_begin) {
-    struct summary *sum_end = make_summary();
-    report_summary(sum_end, sum_begin, false);
-    report_summary(sum_end, sum_begin, true);
+    if (sum_begin) {
+        struct summary *sum_end = make_summary();
+        report_summary(sum_end, sum_begin, false);
+        report_summary(sum_end, sum_begin, true);
+        return 0;
+    }
     return 0;
-  }
-  return 0;
 }
 
 static int tolua_write_map(lua_State * L)
 {
-  const char *filename = tolua_tostring(L, 1, 0);
-  if (filename) {
-    crwritemap(filename);
-  }
-  return 0;
+    const char *filename = tolua_tostring(L, 1, 0);
+    if (filename) {
+        crwritemap(filename);
+    }
+    return 0;
 }
 
 static int tolua_read_turn(lua_State * L)
 {
-  int cturn = current_turn();
-  tolua_pushnumber(L, (lua_Number) cturn);
-  return 1;
+    int cturn = current_turn();
+    tolua_pushnumber(L, (lua_Number)cturn);
+    return 1;
 }
 
 static int tolua_get_region(lua_State * L)
 {
-  int x = (int)tolua_tonumber(L, 1, 0);
-  int y = (int)tolua_tonumber(L, 2, 0);
-  region *r;
-  assert(!pnormalize(&x, &y, findplane(x, y)));
-  r = findregion(x, y);
-  tolua_pushusertype(L, r, TOLUA_CAST "region");
-  return 1;
+    int x = (int)tolua_tonumber(L, 1, 0);
+    int y = (int)tolua_tonumber(L, 2, 0);
+    region *r;
+    assert(!pnormalize(&x, &y, findplane(x, y)));
+    r = findregion(x, y);
+    tolua_pushusertype(L, r, TOLUA_CAST "region");
+    return 1;
 }
 
 static int tolua_get_region_byid(lua_State * L)
 {
-  int uid = (int)tolua_tonumber(L, 1, 0);
-  region *r = findregionbyid(uid);
-  tolua_pushusertype(L, r, TOLUA_CAST "region");
-  return 1;
+    int uid = (int)tolua_tonumber(L, 1, 0);
+    region *r = findregionbyid(uid);
+    tolua_pushusertype(L, r, TOLUA_CAST "region");
+    return 1;
 }
 
 static int tolua_get_building(lua_State * L)
 {
-  int no = tolua_toid(L, 1, 0);
-  building *b = findbuilding(no);
-  tolua_pushusertype(L, b, TOLUA_CAST "building");
-  return 1;
+    int no = tolua_toid(L, 1, 0);
+    building *b = findbuilding(no);
+    tolua_pushusertype(L, b, TOLUA_CAST "building");
+    return 1;
 }
 
 static int tolua_get_ship(lua_State * L)
 {
-  int no = tolua_toid(L, 1, 0);
-  ship *sh = findship(no);
-  tolua_pushusertype(L, sh, TOLUA_CAST "ship");
-  return 1;
+    int no = tolua_toid(L, 1, 0);
+    ship *sh = findship(no);
+    tolua_pushusertype(L, sh, TOLUA_CAST "ship");
+    return 1;
 }
 
 static int tolua_get_alliance(lua_State * L)
 {
-  int no = tolua_toid(L, 1, 0);
-  alliance *f = findalliance(no);
-  tolua_pushusertype(L, f, TOLUA_CAST "alliance");
-  return 1;
+    int no = tolua_toid(L, 1, 0);
+    alliance *f = findalliance(no);
+    tolua_pushusertype(L, f, TOLUA_CAST "alliance");
+    return 1;
 }
 
 static int tolua_get_unit(lua_State * L)
 {
-  int no = tolua_toid(L, 1, 0);
-  unit *u = findunit(no);
-  tolua_pushusertype(L, u, TOLUA_CAST "unit");
-  return 1;
+    int no = tolua_toid(L, 1, 0);
+    unit *u = findunit(no);
+    tolua_pushusertype(L, u, TOLUA_CAST "unit");
+    return 1;
 }
 
 static int tolua_alliance_create(lua_State * L)
 {
-  int id = (int)tolua_tonumber(L, 1, 0);
-  const char *name = tolua_tostring(L, 2, 0);
-  alliance *alli = makealliance(id, name);
-  tolua_pushusertype(L, alli, TOLUA_CAST "alliance");
-  return 1;
+    int id = (int)tolua_tonumber(L, 1, 0);
+    const char *name = tolua_tostring(L, 2, 0);
+    alliance *alli = makealliance(id, name);
+    tolua_pushusertype(L, alli, TOLUA_CAST "alliance");
+    return 1;
 }
 
 static int tolua_get_regions(lua_State * L)
 {
-  region **region_ptr = (region **) lua_newuserdata(L, sizeof(region *));
-  luaL_getmetatable(L, "region");
-  lua_setmetatable(L, -2);
-  *region_ptr = regions;
-  lua_pushcclosure(L, tolua_regionlist_next, 1);
-  return 1;
+    region **region_ptr = (region **)lua_newuserdata(L, sizeof(region *));
+    luaL_getmetatable(L, "region");
+    lua_setmetatable(L, -2);
+    *region_ptr = regions;
+    lua_pushcclosure(L, tolua_regionlist_next, 1);
+    return 1;
 }
 
 static int tolua_get_factions(lua_State * L)
 {
-  faction **faction_ptr = (faction **) lua_newuserdata(L, sizeof(faction *));
-  luaL_getmetatable(L, "faction");
-  lua_setmetatable(L, -2);
-  *faction_ptr = factions;
-  lua_pushcclosure(L, tolua_factionlist_next, 1);
-  return 1;
+    faction **faction_ptr = (faction **)lua_newuserdata(L, sizeof(faction *));
+    luaL_getmetatable(L, "faction");
+    lua_setmetatable(L, -2);
+    *faction_ptr = factions;
+    lua_pushcclosure(L, tolua_factionlist_next, 1);
+    return 1;
 }
 
 static int tolua_get_alliance_factions(lua_State * L)
 {
-  alliance *self = (alliance *) tolua_tousertype(L, 1, 0);
-  return tolua_quicklist_push(L, "faction_list", "faction", self->members);
+    alliance *self = (alliance *)tolua_tousertype(L, 1, 0);
+    return tolua_quicklist_push(L, "faction_list", "faction", self->members);
 }
 
 static int tolua_get_alliance_id(lua_State * L)
 {
-  alliance *self = (alliance *) tolua_tousertype(L, 1, 0);
-  tolua_pushnumber(L, (lua_Number) self->id);
-  return 1;
+    alliance *self = (alliance *)tolua_tousertype(L, 1, 0);
+    tolua_pushnumber(L, (lua_Number)self->id);
+    return 1;
 }
 
 static int tolua_get_alliance_name(lua_State * L)
 {
-  alliance *self = (alliance *) tolua_tousertype(L, 1, 0);
-  tolua_pushstring(L, self->name);
-  return 1;
+    alliance *self = (alliance *)tolua_tousertype(L, 1, 0);
+    tolua_pushstring(L, self->name);
+    return 1;
 }
 
 static int tolua_set_alliance_name(lua_State * L)
 {
-  alliance *self = (alliance *) tolua_tousertype(L, 1, 0);
-  alliance_setname(self, tolua_tostring(L, 2, 0));
-  return 0;
+    alliance *self = (alliance *)tolua_tousertype(L, 1, 0);
+    alliance_setname(self, tolua_tostring(L, 2, 0));
+    return 0;
 }
 
 #ifdef WRITE_SPELLS
@@ -680,97 +685,97 @@ static int tolua_set_alliance_name(lua_State * L)
 #include <kernel/spell.h>
 static int tolua_write_spells(lua_State * L)
 {
-  spell_f fun = (spell_f) get_function("lua_castspell");
-  const char *filename = "magic.xml";
-  xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0");
-  xmlNodePtr root = xmlNewNode(NULL, BAD_CAST "spells");
-  quicklist *ql;
-  int qi;
-  for (ql = spells, qi = 0; ql; ql_advance(&ql, &qi, 1)) {
-    spell *sp = (spell *) ql_get(ql, qi);
-    if (sp->cast != fun) {
-      int combat = 0;
-      xmlNodePtr node = xmlNewNode(NULL, BAD_CAST "spell");
-      xmlNewProp(node, BAD_CAST "name", BAD_CAST sp->sname);
-      xmlNewProp(node, BAD_CAST "type", BAD_CAST magic_school[sp->magietyp]);
-      xmlNewProp(node, BAD_CAST "rank", xml_i(sp->rank));
-      xmlNewProp(node, BAD_CAST "level", xml_i(sp->level));
-      xmlNewProp(node, BAD_CAST "index", xml_i(sp->id));
-      if (sp->syntax)
-        xmlNewProp(node, BAD_CAST "syntax", BAD_CAST sp->syntax);
-      if (sp->parameter)
-        xmlNewProp(node, BAD_CAST "parameters", BAD_CAST sp->parameter);
-      if (sp->components) {
-        spell_component *comp = sp->components;
-        for (; comp->type != 0; ++comp) {
-          static const char *costs[] = { "fixed", "level", "linear" };
-          xmlNodePtr cnode = xmlNewNode(NULL, BAD_CAST "resource");
-          xmlNewProp(cnode, BAD_CAST "name", BAD_CAST comp->type->_name);
-          xmlNewProp(cnode, BAD_CAST "amount", xml_i(comp->amount));
-          xmlNewProp(cnode, BAD_CAST "cost", BAD_CAST costs[comp->cost]);
-          xmlAddChild(node, cnode);
-      }}
-      if (sp->sptyp & TESTCANSEE) {
-        xmlNewProp(node, BAD_CAST "los", BAD_CAST "true");
-      }
-      if (sp->sptyp & ONSHIPCAST) {
-        xmlNewProp(node, BAD_CAST "ship", BAD_CAST "true");
-      }
-      if (sp->sptyp & OCEANCASTABLE) {
-        xmlNewProp(node, BAD_CAST "ocean", BAD_CAST "true");
-      }
-      if (sp->sptyp & FARCASTING) {
-        xmlNewProp(node, BAD_CAST "far", BAD_CAST "true");
-      }
-      if (sp->sptyp & SPELLLEVEL) {
-        xmlNewProp(node, BAD_CAST "variable", BAD_CAST "true");
-      }
-      if (sp->sptyp & POSTCOMBATSPELL)
-        combat = 3;
+    spell_f fun = (spell_f) get_function("lua_castspell");
+    const char *filename = "magic.xml";
+    xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0");
+    xmlNodePtr root = xmlNewNode(NULL, BAD_CAST "spells");
+    quicklist *ql;
+    int qi;
+    for (ql = spells, qi = 0; ql; ql_advance(&ql, &qi, 1)) {
+        spell *sp = (spell *) ql_get(ql, qi);
+        if (sp->cast != fun) {
+            int combat = 0;
+            xmlNodePtr node = xmlNewNode(NULL, BAD_CAST "spell");
+            xmlNewProp(node, BAD_CAST "name", BAD_CAST sp->sname);
+            xmlNewProp(node, BAD_CAST "type", BAD_CAST magic_school[sp->magietyp]);
+            xmlNewProp(node, BAD_CAST "rank", xml_i(sp->rank));
+            xmlNewProp(node, BAD_CAST "level", xml_i(sp->level));
+            xmlNewProp(node, BAD_CAST "index", xml_i(sp->id));
+            if (sp->syntax)
+                xmlNewProp(node, BAD_CAST "syntax", BAD_CAST sp->syntax);
+            if (sp->parameter)
+                xmlNewProp(node, BAD_CAST "parameters", BAD_CAST sp->parameter);
+            if (sp->components) {
+                spell_component *comp = sp->components;
+                for (; comp->type != 0; ++comp) {
+                    static const char *costs[] = { "fixed", "level", "linear" };
+                    xmlNodePtr cnode = xmlNewNode(NULL, BAD_CAST "resource");
+                    xmlNewProp(cnode, BAD_CAST "name", BAD_CAST comp->type->_name);
+                    xmlNewProp(cnode, BAD_CAST "amount", xml_i(comp->amount));
+                    xmlNewProp(cnode, BAD_CAST "cost", BAD_CAST costs[comp->cost]);
+                    xmlAddChild(node, cnode);
+                }}
+            if (sp->sptyp & TESTCANSEE) {
+                xmlNewProp(node, BAD_CAST "los", BAD_CAST "true");
+            }
+            if (sp->sptyp & ONSHIPCAST) {
+                xmlNewProp(node, BAD_CAST "ship", BAD_CAST "true");
+            }
+            if (sp->sptyp & OCEANCASTABLE) {
+                xmlNewProp(node, BAD_CAST "ocean", BAD_CAST "true");
+            }
+            if (sp->sptyp & FARCASTING) {
+                xmlNewProp(node, BAD_CAST "far", BAD_CAST "true");
+            }
+            if (sp->sptyp & SPELLLEVEL) {
+                xmlNewProp(node, BAD_CAST "variable", BAD_CAST "true");
+            }
+            if (sp->sptyp & POSTCOMBATSPELL)
+                combat = 3;
 
-      else if (sp->sptyp & COMBATSPELL)
-        combat = 2;
+            else if (sp->sptyp & COMBATSPELL)
+                combat = 2;
 
-      else if (sp->sptyp & PRECOMBATSPELL)
-        combat = 1;
-      if (combat) {
-        xmlNewProp(node, BAD_CAST "combat", xml_i(combat));
-      }
-      xmlAddChild(root, node);
+            else if (sp->sptyp & PRECOMBATSPELL)
+                combat = 1;
+            if (combat) {
+                xmlNewProp(node, BAD_CAST "combat", xml_i(combat));
+            }
+            xmlAddChild(root, node);
+        }
     }
-  }
-  xmlDocSetRootElement(doc, root);
-  xmlKeepBlanksDefault(0);
-  xmlSaveFormatFileEnc(filename, doc, "utf-8", 1);
-  xmlFreeDoc(doc);
-  return 0;
+    xmlDocSetRootElement(doc, root);
+    xmlKeepBlanksDefault(0);
+    xmlSaveFormatFileEnc(filename, doc, "utf-8", 1);
+    xmlFreeDoc(doc);
+    return 0;
 }
 #endif
 
 static int config_get_ships(lua_State * L)
 {
-  quicklist *ql;
-  int qi, i = 0;
-  lua_createtable(L, ql_length(shiptypes), 0);
-  for (qi = 0, ql = shiptypes; ql; ql_advance(&ql, &qi, 1)) {
-    ship_type *stype = (ship_type *) ql_get(ql, qi);
-    tolua_pushstring(L, TOLUA_CAST stype->_name);
-    lua_rawseti(L, -2, ++i);
-  }
-  return 1;
+    quicklist *ql;
+    int qi, i = 0;
+    lua_createtable(L, ql_length(shiptypes), 0);
+    for (qi = 0, ql = shiptypes; ql; ql_advance(&ql, &qi, 1)) {
+        ship_type *stype = (ship_type *)ql_get(ql, qi);
+        tolua_pushstring(L, TOLUA_CAST stype->_name);
+        lua_rawseti(L, -2, ++i);
+    }
+    return 1;
 }
 
 static int config_get_buildings(lua_State * L)
 {
-  quicklist *ql;
-  int qi, i = 0;
-  lua_createtable(L, ql_length(buildingtypes), 0);
-  for (qi = 0, ql = buildingtypes; ql; ql_advance(&ql, &qi, 1)) {
-    building_type *btype = (building_type *) ql_get(ql, qi);
-    tolua_pushstring(L, TOLUA_CAST btype->_name);
-    lua_rawseti(L, -2, ++i);
-  }
-  return 1;
+    quicklist *ql;
+    int qi, i = 0;
+    lua_createtable(L, ql_length(buildingtypes), 0);
+    for (qi = 0, ql = buildingtypes; ql; ql_advance(&ql, &qi, 1)) {
+        building_type *btype = (building_type *)ql_get(ql, qi);
+        tolua_pushstring(L, TOLUA_CAST btype->_name);
+        lua_rawseti(L, -2, ++i);
+    }
+    return 1;
 }
 
 static int config_get_locales(lua_State * L)
@@ -788,210 +793,210 @@ static int config_get_locales(lua_State * L)
 
 static int config_get_resource(lua_State * L)
 {
-  const char *name = tolua_tostring(L, 1, 0);
-  if (name) {
-    const struct item_type *itype = it_find(name);
-    if (itype) {
-      lua_newtable(L);
-      lua_pushstring(L, "weight");
-      lua_pushinteger(L, itype->weight);
-      lua_settable(L, -3);
-      if (itype->capacity > 0) {
-        lua_pushstring(L, "capacity");
-        lua_pushinteger(L, itype->capacity);
-        lua_settable(L, -3);
-      }
-      if (itype->construction) {
-        int i;
-        lua_pushstring(L, "build_skill_min");
-        lua_pushinteger(L, itype->construction->minskill);
-        lua_settable(L, -3);
-        lua_pushstring(L, "build_skill_name");
-        lua_pushstring(L, skillnames[itype->construction->skill]);
-        lua_settable(L, -3);
-        if (itype->construction->materials) {
-          lua_pushstring(L, "materials");
-          lua_newtable(L);
-          for (i = 0; itype->construction->materials[i].number; ++i) {
-            lua_pushstring(L,
-              itype->construction->materials[i].rtype->_name);
-            lua_pushinteger(L, itype->construction->materials[i].number);
+    const char *name = tolua_tostring(L, 1, 0);
+    if (name) {
+        const struct item_type *itype = it_find(name);
+        if (itype) {
+            lua_newtable(L);
+            lua_pushstring(L, "weight");
+            lua_pushinteger(L, itype->weight);
             lua_settable(L, -3);
-          }
-          lua_settable(L, -3);
+            if (itype->capacity > 0) {
+                lua_pushstring(L, "capacity");
+                lua_pushinteger(L, itype->capacity);
+                lua_settable(L, -3);
+            }
+            if (itype->construction) {
+                int i;
+                lua_pushstring(L, "build_skill_min");
+                lua_pushinteger(L, itype->construction->minskill);
+                lua_settable(L, -3);
+                lua_pushstring(L, "build_skill_name");
+                lua_pushstring(L, skillnames[itype->construction->skill]);
+                lua_settable(L, -3);
+                if (itype->construction->materials) {
+                    lua_pushstring(L, "materials");
+                    lua_newtable(L);
+                    for (i = 0; itype->construction->materials[i].number; ++i) {
+                        lua_pushstring(L,
+                            itype->construction->materials[i].rtype->_name);
+                        lua_pushinteger(L, itype->construction->materials[i].number);
+                        lua_settable(L, -3);
+                    }
+                    lua_settable(L, -3);
+                }
+            }
+            return 1;
         }
-      }
-      return 1;
     }
-  }
-  return 0;
+    return 0;
 }
 
 static int config_get_btype(lua_State * L)
 {
-  const char *name = tolua_tostring(L, 1, 0);
+    const char *name = tolua_tostring(L, 1, 0);
 
-  if (name) {
-    const struct building_type *btype = bt_find(name);
-    if (btype) {
-      lua_newtable(L);
-      lua_pushstring(L, "flags");
-      lua_pushinteger(L, btype->flags);
-      lua_settable(L, -3);
-      if (btype->capacity > 0) {
-        lua_pushstring(L, "capacity");
-        lua_pushinteger(L, btype->capacity);
-        lua_settable(L, -3);
-      }
-      if (btype->maxcapacity > 0) {
-        lua_pushstring(L, "maxcapacity");
-        lua_pushinteger(L, btype->maxcapacity);
-        lua_settable(L, -3);
-      }
-      if (btype->maxsize > 0) {
-        lua_pushstring(L, "maxsize");
-        lua_pushinteger(L, btype->maxsize);
-        lua_settable(L, -3);
-      }
-      if (btype->maintenance) {
-        int i;
-        lua_pushstring(L, "maintenance");
-        lua_newtable(L);
-        for (i = 0; btype->maintenance[i].number; ++i) {
-          lua_pushstring(L,
-              btype->maintenance[i].rtype->_name);
-          lua_pushinteger(L, btype->maintenance[i].number);
-          lua_settable(L, -3);
-        }
-        lua_settable(L, -3);
-      }
-      if (btype->construction) {
-        int i;
-        lua_pushstring(L, "build_skill_min");
-        lua_pushinteger(L, btype->construction->minskill);
-        lua_settable(L, -3);
-        lua_pushstring(L, "build_skill_name");
-        lua_pushstring(L, skillnames[btype->construction->skill]);
-        lua_settable(L, -3);
-        if (btype->construction->materials) {
-          lua_pushstring(L, "materials");
-          lua_newtable(L);
-          for (i = 0; btype->construction->materials[i].number; ++i) {
-            lua_pushstring(L,
-              btype->construction->materials[i].rtype->_name);
-            lua_pushinteger(L, btype->construction->materials[i].number);
+    if (name) {
+        const struct building_type *btype = bt_find(name);
+        if (btype) {
+            lua_newtable(L);
+            lua_pushstring(L, "flags");
+            lua_pushinteger(L, btype->flags);
             lua_settable(L, -3);
-          }
-          lua_settable(L, -3);
+            if (btype->capacity > 0) {
+                lua_pushstring(L, "capacity");
+                lua_pushinteger(L, btype->capacity);
+                lua_settable(L, -3);
+            }
+            if (btype->maxcapacity > 0) {
+                lua_pushstring(L, "maxcapacity");
+                lua_pushinteger(L, btype->maxcapacity);
+                lua_settable(L, -3);
+            }
+            if (btype->maxsize > 0) {
+                lua_pushstring(L, "maxsize");
+                lua_pushinteger(L, btype->maxsize);
+                lua_settable(L, -3);
+            }
+            if (btype->maintenance) {
+                int i;
+                lua_pushstring(L, "maintenance");
+                lua_newtable(L);
+                for (i = 0; btype->maintenance[i].number; ++i) {
+                    lua_pushstring(L,
+                        btype->maintenance[i].rtype->_name);
+                    lua_pushinteger(L, btype->maintenance[i].number);
+                    lua_settable(L, -3);
+                }
+                lua_settable(L, -3);
+            }
+            if (btype->construction) {
+                int i;
+                lua_pushstring(L, "build_skill_min");
+                lua_pushinteger(L, btype->construction->minskill);
+                lua_settable(L, -3);
+                lua_pushstring(L, "build_skill_name");
+                lua_pushstring(L, skillnames[btype->construction->skill]);
+                lua_settable(L, -3);
+                if (btype->construction->materials) {
+                    lua_pushstring(L, "materials");
+                    lua_newtable(L);
+                    for (i = 0; btype->construction->materials[i].number; ++i) {
+                        lua_pushstring(L,
+                            btype->construction->materials[i].rtype->_name);
+                        lua_pushinteger(L, btype->construction->materials[i].number);
+                        lua_settable(L, -3);
+                    }
+                    lua_settable(L, -3);
+                }
+            }
+            return 1;
         }
-      }
-      return 1;
     }
-  }
-  return 0;
+    return 0;
 }
 
 static int config_get_stype(lua_State * L)
 {
-  const char *name = tolua_tostring(L, 1, 0);
+    const char *name = tolua_tostring(L, 1, 0);
 
-  if (name) {
-    const struct ship_type *stype = st_find(name);
-    if (stype) {
-      lua_newtable(L);
-      lua_pushstring(L, "range");
-      lua_pushinteger(L, stype->range);
-      lua_settable(L, -3);
-      lua_pushstring(L, "cabins");
-      lua_pushinteger(L, stype->cabins);
-      lua_settable(L, -3);
-      lua_pushstring(L, "cargo");
-      lua_pushinteger(L, stype->cargo);
-      lua_settable(L, -3);
-      lua_pushstring(L, "cptskill");
-      lua_pushinteger(L, stype->cptskill);
-      lua_settable(L, -3);
-      lua_pushstring(L, "minskill");
-      lua_pushinteger(L, stype->minskill);
-      lua_settable(L, -3);
-      lua_pushstring(L, "sumskill");
-      lua_pushinteger(L, stype->sumskill);
-      lua_settable(L, -3);
-      lua_pushstring(L, "fishing");
-      lua_pushinteger(L, stype->fishing);
-      lua_settable(L, -3);
-      if (stype->coasts) {
-        const terrain_type *coast = *stype->coasts;
-        lua_pushstring(L, "coasts");
-        lua_newtable(L);
-        while(coast) {
-          lua_pushstring(L, coast->_name);
-          lua_pushinteger(L, 1);
-          lua_settable(L, -3);
-          coast = coast->next;
-        }
-      }
-      if (stype->construction) {
-        int i;
-        lua_pushstring(L, "build_skill_min");
-        lua_pushinteger(L, stype->construction->minskill);
-        lua_settable(L, -3);
-        lua_pushstring(L, "build_skill_name");
-        lua_pushstring(L, skillnames[stype->construction->skill]);
-        lua_settable(L, -3);
-        if (stype->construction->materials) {
-          lua_pushstring(L, "materials");
-          lua_newtable(L);
-          for (i = 0; stype->construction->materials[i].number; ++i) {
-            lua_pushstring(L,
-              stype->construction->materials[i].rtype->_name);
-            lua_pushinteger(L, stype->construction->materials[i].number);
+    if (name) {
+        const struct ship_type *stype = st_find(name);
+        if (stype) {
+            lua_newtable(L);
+            lua_pushstring(L, "range");
+            lua_pushinteger(L, stype->range);
             lua_settable(L, -3);
-          }
-          lua_settable(L, -3);
+            lua_pushstring(L, "cabins");
+            lua_pushinteger(L, stype->cabins);
+            lua_settable(L, -3);
+            lua_pushstring(L, "cargo");
+            lua_pushinteger(L, stype->cargo);
+            lua_settable(L, -3);
+            lua_pushstring(L, "cptskill");
+            lua_pushinteger(L, stype->cptskill);
+            lua_settable(L, -3);
+            lua_pushstring(L, "minskill");
+            lua_pushinteger(L, stype->minskill);
+            lua_settable(L, -3);
+            lua_pushstring(L, "sumskill");
+            lua_pushinteger(L, stype->sumskill);
+            lua_settable(L, -3);
+            lua_pushstring(L, "fishing");
+            lua_pushinteger(L, stype->fishing);
+            lua_settable(L, -3);
+            if (stype->coasts) {
+                const terrain_type *coast = *stype->coasts;
+                lua_pushstring(L, "coasts");
+                lua_newtable(L);
+                while (coast) {
+                    lua_pushstring(L, coast->_name);
+                    lua_pushinteger(L, 1);
+                    lua_settable(L, -3);
+                    coast = coast->next;
+                }
+            }
+            if (stype->construction) {
+                int i;
+                lua_pushstring(L, "build_skill_min");
+                lua_pushinteger(L, stype->construction->minskill);
+                lua_settable(L, -3);
+                lua_pushstring(L, "build_skill_name");
+                lua_pushstring(L, skillnames[stype->construction->skill]);
+                lua_settable(L, -3);
+                if (stype->construction->materials) {
+                    lua_pushstring(L, "materials");
+                    lua_newtable(L);
+                    for (i = 0; stype->construction->materials[i].number; ++i) {
+                        lua_pushstring(L,
+                            stype->construction->materials[i].rtype->_name);
+                        lua_pushinteger(L, stype->construction->materials[i].number);
+                        lua_settable(L, -3);
+                    }
+                    lua_settable(L, -3);
+                }
+            }
+            return 1;
         }
-      }
-      return 1;
     }
-  }
-  return 0;
+    return 0;
 }
 
 static int tolua_get_spell_text(lua_State * L)
 {
-  const struct locale *loc = default_locale;
-  spell *self = (spell *) tolua_tousertype(L, 1, 0);
-  lua_pushstring(L, spell_info(self, loc));
-  return 1;
+    const struct locale *loc = default_locale;
+    spell *self = (spell *)tolua_tousertype(L, 1, 0);
+    lua_pushstring(L, spell_info(self, loc));
+    return 1;
 }
 
 #ifdef TODO
 static int tolua_get_spell_school(lua_State * L)
 {
-  spell *self = (spell *) tolua_tousertype(L, 1, 0);
-  lua_pushstring(L, magic_school[self->magietyp]);
-  return 1;
+    spell *self = (spell *) tolua_tousertype(L, 1, 0);
+    lua_pushstring(L, magic_school[self->magietyp]);
+    return 1;
 }
 
 static int tolua_get_spell_level(lua_State * L)
 {
-  spell *self = (spell *) tolua_tousertype(L, 1, 0);
-  lua_pushnumber(L, self->level);
-  return 1;
+    spell *self = (spell *) tolua_tousertype(L, 1, 0);
+    lua_pushnumber(L, self->level);
+    return 1;
 }
 #endif
 
 static int tolua_get_spell_name(lua_State * L)
 {
-  const struct locale *lang = default_locale;
-  spell *self = (spell *) tolua_tousertype(L, 1, 0);
-  lua_pushstring(L, spell_name(self, lang));
-  return 1;
+    const struct locale *lang = default_locale;
+    spell *self = (spell *)tolua_tousertype(L, 1, 0);
+    lua_pushstring(L, spell_name(self, lang));
+    return 1;
 }
 
 static int tolua_get_spells(lua_State * L)
 {
-  return tolua_quicklist_push(L, "spell_list", "spell", spells);
+    return tolua_quicklist_push(L, "spell_list", "spell", spells);
 }
 
 static int init_data(const char *filename, const char *catalog)
@@ -1011,26 +1016,26 @@ static int init_data(const char *filename, const char *catalog)
 
 int tolua_read_xml(lua_State * L)
 {
-  const char *filename = tolua_tostring(L, 1, "config.xml");
-  const char *catalog = tolua_tostring(L, 2, "catalog.xml");
-  lua_pushinteger(L, init_data(filename, catalog));
-  return 1;
+    const char *filename = tolua_tostring(L, 1, "config.xml");
+    const char *catalog = tolua_tostring(L, 2, "catalog.xml");
+    lua_pushinteger(L, init_data(filename, catalog));
+    return 1;
 }
 
 typedef struct event_args {
-  int hfunction;
-  int hargs;
-  const char *sendertype;
+    int hfunction;
+    int hargs;
+    const char *sendertype;
 } event_args;
 
 static int tolua_report_unit(lua_State * L)
 {
-  char buffer[512];
-  unit *u = (unit *) tolua_tousertype(L, 1, 0);
-  faction *f = (faction *) tolua_tousertype(L, 2, 0);
-  bufunit(f, u, 0, see_unit, buffer, sizeof(buffer));
-  tolua_pushstring(L, buffer);
-  return 1;
+    char buffer[512];
+    unit *u = (unit *)tolua_tousertype(L, 1, 0);
+    faction *f = (faction *)tolua_tousertype(L, 2, 0);
+    bufunit(f, u, 0, see_unit, buffer, sizeof(buffer));
+    tolua_pushstring(L, buffer);
+    return 1;
 }
 
 static void parse_inifile(lua_State * L, dictionary * d, const char *section)
@@ -1075,148 +1080,148 @@ void tolua_bind_open(lua_State * L);
 
 int tolua_bindings_open(lua_State * L)
 {
-  tolua_open(L);
+    tolua_open(L);
 
-  tolua_bind_open(L);
+    tolua_bind_open(L);
 
-  /* register user types */
-  tolua_usertype(L, TOLUA_CAST "spell");
-  tolua_usertype(L, TOLUA_CAST "spell_list");
-  tolua_usertype(L, TOLUA_CAST "order");
-  tolua_usertype(L, TOLUA_CAST "item");
-  tolua_usertype(L, TOLUA_CAST "alliance");
-  tolua_usertype(L, TOLUA_CAST "event");
-  tolua_usertype(L, TOLUA_CAST "faction_list");
-  tolua_module(L, NULL, 0);
-  tolua_beginmodule(L, NULL);
-  {
-    tolua_cclass(L, TOLUA_CAST "alliance", TOLUA_CAST "alliance",
-      TOLUA_CAST "", NULL);
-    tolua_beginmodule(L, TOLUA_CAST "alliance");
+    /* register user types */
+    tolua_usertype(L, TOLUA_CAST "spell");
+    tolua_usertype(L, TOLUA_CAST "spell_list");
+    tolua_usertype(L, TOLUA_CAST "order");
+    tolua_usertype(L, TOLUA_CAST "item");
+    tolua_usertype(L, TOLUA_CAST "alliance");
+    tolua_usertype(L, TOLUA_CAST "event");
+    tolua_usertype(L, TOLUA_CAST "faction_list");
+    tolua_module(L, NULL, 0);
+    tolua_beginmodule(L, NULL);
     {
-      tolua_variable(L, TOLUA_CAST "name", tolua_get_alliance_name,
-        tolua_set_alliance_name);
-      tolua_variable(L, TOLUA_CAST "id", tolua_get_alliance_id, NULL);
-      tolua_variable(L, TOLUA_CAST "factions", &tolua_get_alliance_factions,
-        NULL);
-      tolua_function(L, TOLUA_CAST "create", tolua_alliance_create);
-    } tolua_endmodule(L);
-    tolua_cclass(L, TOLUA_CAST "spell", TOLUA_CAST "spell", TOLUA_CAST "",
-      NULL);
-    tolua_beginmodule(L, TOLUA_CAST "spell");
-    {
-      tolua_function(L, TOLUA_CAST "__tostring", tolua_get_spell_name);
-      tolua_variable(L, TOLUA_CAST "name", tolua_get_spell_name, 0);
+        tolua_cclass(L, TOLUA_CAST "alliance", TOLUA_CAST "alliance",
+            TOLUA_CAST "", NULL);
+        tolua_beginmodule(L, TOLUA_CAST "alliance");
+        {
+            tolua_variable(L, TOLUA_CAST "name", tolua_get_alliance_name,
+                tolua_set_alliance_name);
+            tolua_variable(L, TOLUA_CAST "id", tolua_get_alliance_id, NULL);
+            tolua_variable(L, TOLUA_CAST "factions", &tolua_get_alliance_factions,
+                NULL);
+            tolua_function(L, TOLUA_CAST "create", tolua_alliance_create);
+        } tolua_endmodule(L);
+        tolua_cclass(L, TOLUA_CAST "spell", TOLUA_CAST "spell", TOLUA_CAST "",
+            NULL);
+        tolua_beginmodule(L, TOLUA_CAST "spell");
+        {
+            tolua_function(L, TOLUA_CAST "__tostring", tolua_get_spell_name);
+            tolua_variable(L, TOLUA_CAST "name", tolua_get_spell_name, 0);
 #ifdef TODO
-      tolua_variable(L, TOLUA_CAST "school", tolua_get_spell_school, 0);
-      tolua_variable(L, TOLUA_CAST "level", tolua_get_spell_level, 0);
+            tolua_variable(L, TOLUA_CAST "school", tolua_get_spell_school, 0);
+            tolua_variable(L, TOLUA_CAST "level", tolua_get_spell_level, 0);
 #endif
-      tolua_variable(L, TOLUA_CAST "text", tolua_get_spell_text, 0);
-    } tolua_endmodule(L);
-    tolua_module(L, TOLUA_CAST "report", 1);
-    tolua_beginmodule(L, TOLUA_CAST "report");
-    {
-      tolua_function(L, TOLUA_CAST "report_unit", &tolua_report_unit);
-    } tolua_endmodule(L);
-    tolua_module(L, TOLUA_CAST "config", 1);
-    tolua_beginmodule(L, TOLUA_CAST "config");
-    {
-      parse_inifile(L, global.inifile, "lua");
-      tolua_variable(L, TOLUA_CAST "locales", &config_get_locales, 0);
-      tolua_function(L, TOLUA_CAST "get_resource", &config_get_resource);
-      tolua_variable(L, TOLUA_CAST "buildings", &config_get_buildings, 0);
-      tolua_function(L, TOLUA_CAST "get_building", &config_get_btype);
-      tolua_variable(L, TOLUA_CAST "ships", &config_get_ships, 0);
-      tolua_function(L, TOLUA_CAST "get_ship", &config_get_stype);
-    } tolua_endmodule(L);
-    tolua_function(L, TOLUA_CAST "get_region_by_id", tolua_get_region_byid);
-    tolua_function(L, TOLUA_CAST "get_unit", tolua_get_unit);
-    tolua_function(L, TOLUA_CAST "get_alliance", tolua_get_alliance);
-    tolua_function(L, TOLUA_CAST "get_ship", tolua_get_ship);
-    tolua_function(L, TOLUA_CAST "get_building", tolua_get_building);
-    tolua_function(L, TOLUA_CAST "get_region", tolua_get_region);
-    tolua_function(L, TOLUA_CAST "factions", tolua_get_factions);
-    tolua_function(L, TOLUA_CAST "regions", tolua_get_regions);
-    tolua_function(L, TOLUA_CAST "read_turn", tolua_read_turn);
-    tolua_function(L, TOLUA_CAST "write_map", &tolua_write_map);
-    tolua_function(L, TOLUA_CAST "read_orders", tolua_read_orders);
-    tolua_function(L, TOLUA_CAST "process_orders", tolua_process_orders);
-    tolua_function(L, TOLUA_CAST "init_reports", tolua_init_reports);
-    tolua_function(L, TOLUA_CAST "write_reports", tolua_write_reports);
-    tolua_function(L, TOLUA_CAST "write_report", tolua_write_report);
-    tolua_function(L, TOLUA_CAST "init_summary", tolua_init_summary);
-    tolua_function(L, TOLUA_CAST "write_summary", tolua_write_summary);
-    tolua_function(L, TOLUA_CAST "write_passwords", tolua_write_passwords);
-    tolua_function(L, TOLUA_CAST "message_unit", tolua_message_unit);
-    tolua_function(L, TOLUA_CAST "message_faction", tolua_message_faction);
-    tolua_function(L, TOLUA_CAST "message_region", tolua_message_region);
+            tolua_variable(L, TOLUA_CAST "text", tolua_get_spell_text, 0);
+        } tolua_endmodule(L);
+        tolua_module(L, TOLUA_CAST "report", 1);
+        tolua_beginmodule(L, TOLUA_CAST "report");
+        {
+            tolua_function(L, TOLUA_CAST "report_unit", &tolua_report_unit);
+        } tolua_endmodule(L);
+        tolua_module(L, TOLUA_CAST "config", 1);
+        tolua_beginmodule(L, TOLUA_CAST "config");
+        {
+            parse_inifile(L, global.inifile, "lua");
+            tolua_variable(L, TOLUA_CAST "locales", &config_get_locales, 0);
+            tolua_function(L, TOLUA_CAST "get_resource", &config_get_resource);
+            tolua_variable(L, TOLUA_CAST "buildings", &config_get_buildings, 0);
+            tolua_function(L, TOLUA_CAST "get_building", &config_get_btype);
+            tolua_variable(L, TOLUA_CAST "ships", &config_get_ships, 0);
+            tolua_function(L, TOLUA_CAST "get_ship", &config_get_stype);
+        } tolua_endmodule(L);
+        tolua_function(L, TOLUA_CAST "get_region_by_id", tolua_get_region_byid);
+        tolua_function(L, TOLUA_CAST "get_unit", tolua_get_unit);
+        tolua_function(L, TOLUA_CAST "get_alliance", tolua_get_alliance);
+        tolua_function(L, TOLUA_CAST "get_ship", tolua_get_ship);
+        tolua_function(L, TOLUA_CAST "get_building", tolua_get_building);
+        tolua_function(L, TOLUA_CAST "get_region", tolua_get_region);
+        tolua_function(L, TOLUA_CAST "factions", tolua_get_factions);
+        tolua_function(L, TOLUA_CAST "regions", tolua_get_regions);
+        tolua_function(L, TOLUA_CAST "read_turn", tolua_read_turn);
+        tolua_function(L, TOLUA_CAST "write_map", &tolua_write_map);
+        tolua_function(L, TOLUA_CAST "read_orders", tolua_read_orders);
+        tolua_function(L, TOLUA_CAST "process_orders", tolua_process_orders);
+        tolua_function(L, TOLUA_CAST "init_reports", tolua_init_reports);
+        tolua_function(L, TOLUA_CAST "write_reports", tolua_write_reports);
+        tolua_function(L, TOLUA_CAST "write_report", tolua_write_report);
+        tolua_function(L, TOLUA_CAST "init_summary", tolua_init_summary);
+        tolua_function(L, TOLUA_CAST "write_summary", tolua_write_summary);
+        tolua_function(L, TOLUA_CAST "write_passwords", tolua_write_passwords);
+        tolua_function(L, TOLUA_CAST "message_unit", tolua_message_unit);
+        tolua_function(L, TOLUA_CAST "message_faction", tolua_message_faction);
+        tolua_function(L, TOLUA_CAST "message_region", tolua_message_region);
 
-    /* scripted monsters */
-    tolua_function(L, TOLUA_CAST "spawn_braineaters", tolua_spawn_braineaters);
+        /* scripted monsters */
+        tolua_function(L, TOLUA_CAST "spawn_braineaters", tolua_spawn_braineaters);
 
-    tolua_function(L, TOLUA_CAST "update_guards", tolua_update_guards);
-    tolua_function(L, TOLUA_CAST "set_turn", &tolua_set_turn);
-    tolua_function(L, TOLUA_CAST "get_turn", &tolua_get_turn);
-    tolua_function(L, TOLUA_CAST "get_season", tolua_get_season);
-    tolua_function(L, TOLUA_CAST "equipment_setitem", tolua_equipment_setitem);
-    tolua_function(L, TOLUA_CAST "equip_unit", tolua_equipunit);
-    tolua_function(L, TOLUA_CAST "add_equipment", tolua_addequipment);
-    tolua_function(L, TOLUA_CAST "atoi36", tolua_atoi36);
-    tolua_function(L, TOLUA_CAST "itoa36", tolua_itoa36);
-    tolua_function(L, TOLUA_CAST "dice_roll", tolua_dice_rand);
-    tolua_function(L, TOLUA_CAST "get_nmrs", tolua_get_nmrs);
-    tolua_function(L, TOLUA_CAST "remove_empty_units", tolua_remove_empty_units);
-    tolua_function(L, TOLUA_CAST "update_subscriptions", tolua_update_subscriptions);
-    tolua_function(L, TOLUA_CAST "update_scores", tolua_update_scores);
-    tolua_function(L, TOLUA_CAST "update_owners", tolua_update_owners);
-    tolua_function(L, TOLUA_CAST "learn_skill", tolua_learn_skill);
-    tolua_function(L, TOLUA_CAST "create_curse", tolua_create_curse);
-    tolua_function(L, TOLUA_CAST "autoseed", tolua_autoseed);
-    tolua_function(L, TOLUA_CAST "get_key", tolua_getkey);
-    tolua_function(L, TOLUA_CAST "set_key", tolua_setkey);
-    tolua_function(L, TOLUA_CAST "translate", &tolua_translate);
-    tolua_function(L, TOLUA_CAST "rng_int", tolua_rng_int);
-    tolua_function(L, TOLUA_CAST "spells", tolua_get_spells);
+        tolua_function(L, TOLUA_CAST "update_guards", tolua_update_guards);
+        tolua_function(L, TOLUA_CAST "set_turn", &tolua_set_turn);
+        tolua_function(L, TOLUA_CAST "get_turn", &tolua_get_turn);
+        tolua_function(L, TOLUA_CAST "get_season", tolua_get_season);
+        tolua_function(L, TOLUA_CAST "equipment_setitem", tolua_equipment_setitem);
+        tolua_function(L, TOLUA_CAST "equip_unit", tolua_equipunit);
+        tolua_function(L, TOLUA_CAST "add_equipment", tolua_addequipment);
+        tolua_function(L, TOLUA_CAST "atoi36", tolua_atoi36);
+        tolua_function(L, TOLUA_CAST "itoa36", tolua_itoa36);
+        tolua_function(L, TOLUA_CAST "dice_roll", tolua_dice_rand);
+        tolua_function(L, TOLUA_CAST "get_nmrs", tolua_get_nmrs);
+        tolua_function(L, TOLUA_CAST "remove_empty_units", tolua_remove_empty_units);
+        tolua_function(L, TOLUA_CAST "update_subscriptions", tolua_update_subscriptions);
+        tolua_function(L, TOLUA_CAST "update_scores", tolua_update_scores);
+        tolua_function(L, TOLUA_CAST "update_owners", tolua_update_owners);
+        tolua_function(L, TOLUA_CAST "learn_skill", tolua_learn_skill);
+        tolua_function(L, TOLUA_CAST "create_curse", tolua_create_curse);
+        tolua_function(L, TOLUA_CAST "autoseed", tolua_autoseed);
+        tolua_function(L, TOLUA_CAST "get_key", tolua_getkey);
+        tolua_function(L, TOLUA_CAST "set_key", tolua_setkey);
+        tolua_function(L, TOLUA_CAST "translate", &tolua_translate);
+        tolua_function(L, TOLUA_CAST "rng_int", tolua_rng_int);
+        tolua_function(L, TOLUA_CAST "spells", tolua_get_spells);
 #ifdef WRITE_SPELLS
-    tolua_function(L, TOLUA_CAST "write_spells", tolua_write_spells);
+        tolua_function(L, TOLUA_CAST "write_spells", tolua_write_spells);
 #endif
-    tolua_function(L, TOLUA_CAST "read_xml", tolua_read_xml);
-  } tolua_endmodule(L);
-  return 1;
+        tolua_function(L, TOLUA_CAST "read_xml", tolua_read_xml);
+    } tolua_endmodule(L);
+    return 1;
 }
 
 static void openlibs(lua_State * L)
 {
-  luaL_openlibs(L);
+    luaL_openlibs(L);
 }
 
 void lua_done(lua_State * L) {
-  lua_close(L);
+    lua_close(L);
 }
 
 lua_State *lua_init(void) {
-  lua_State *L = luaL_newstate();
+    lua_State *L = luaL_newstate();
 
-  openlibs(L);
-  register_tolua_helpers();
-  tolua_bindings_open(L);
-  tolua_eressea_open(L);
+    openlibs(L);
+    register_tolua_helpers();
+    tolua_bindings_open(L);
+    tolua_eressea_open(L);
 #ifdef USE_SQLITE
-  tolua_sqlite_open(L);
+    tolua_sqlite_open(L);
 #endif
-  tolua_unit_open(L);
-  tolua_building_open(L);
-  tolua_ship_open(L);
-  tolua_region_open(L);
-  tolua_faction_open(L);
-  tolua_unit_open(L);
-  tolua_message_open(L);
-  tolua_dict_open(L);
+    tolua_unit_open(L);
+    tolua_building_open(L);
+    tolua_ship_open(L);
+    tolua_region_open(L);
+    tolua_faction_open(L);
+    tolua_unit_open(L);
+    tolua_message_open(L);
+    tolua_dict_open(L);
 #ifdef USE_CURSES
-  tolua_gmtool_open(L);
+    tolua_gmtool_open(L);
 #endif
-  tolua_storage_open(L);
-  return L;
+    tolua_storage_open(L);
+    return L;
 }
 
 int eressea_run(lua_State *L, const char *luafile)
@@ -1236,7 +1241,8 @@ int eressea_run(lua_State *L, const char *luafile)
         err = lua_pcall(L, 1, 1, -3);
         if (err != 0) {
             log_lua_error(L);
-        } else  {
+        }
+        else  {
             if (lua_isnumber(L, -1)) {
                 err = (int)lua_tonumber(L, -1);
             }
diff --git a/src/bindings.h b/src/bindings.h
index d1b880609..6c71ecf94 100755
--- a/src/bindings.h
+++ b/src/bindings.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
 +-------------------+
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Christian Schlittchen <corwin@amber.kn-bremen.de>
@@ -14,22 +14,22 @@ without prior permission by the authors of Eressea.
 extern "C" {
 #endif
 
-  struct lua_State;
-  struct quicklist;
+    struct lua_State;
+    struct quicklist;
 
-  int tolua_sqlite_open(struct lua_State *L);
-  int tolua_bindings_open(struct lua_State *L);
-  int tolua_spelllist_next(struct lua_State *L);
-  int tolua_itemlist_next(struct lua_State *L);
-  int tolua_orderlist_next(struct lua_State *L);
-  int tolua_quicklist_push(struct lua_State *L, const char *list_type,
-    const char *elem_type, struct quicklist *list);
+    int tolua_sqlite_open(struct lua_State *L);
+    int tolua_bindings_open(struct lua_State *L);
+    int tolua_spelllist_next(struct lua_State *L);
+    int tolua_itemlist_next(struct lua_State *L);
+    int tolua_orderlist_next(struct lua_State *L);
+    int tolua_quicklist_push(struct lua_State *L, const char *list_type,
+        const char *elem_type, struct quicklist *list);
 
-  int log_lua_error(struct lua_State *L);
+    int log_lua_error(struct lua_State *L);
 
-  void lua_done(struct lua_State *L);
-  struct lua_State *lua_init(void);
-  int eressea_run(struct lua_State *L, const char *luafile);
+    void lua_done(struct lua_State *L);
+    struct lua_State *lua_init(void);
+    int eressea_run(struct lua_State *L, const char *luafile);
 
 #ifdef __cplusplus
 }
diff --git a/src/building_action.c b/src/building_action.c
index 32b798bdf..940edb2f1 100644
--- a/src/building_action.c
+++ b/src/building_action.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
 +-------------------+
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Christian Schlittchen <corwin@amber.kn-bremen.de>
@@ -35,37 +35,39 @@ typedef struct building_action {
 
 static int lc_age(struct attrib *a)
 {
-  building_action *data = (building_action *) a->data.v;
-  const char *fname = data->fname;
-  const char *fparam = data->param;
-  building *b = data->b;
-  int result = -1;
+    building_action *data = (building_action *)a->data.v;
+    const char *fname = data->fname;
+    const char *fparam = data->param;
+    building *b = data->b;
+    int result = -1;
 
-  assert(b != NULL);
-  if (fname != NULL) {
-    lua_State *L = (lua_State *) global.vm_state;
+    assert(b != NULL);
+    if (fname != NULL) {
+        lua_State *L = (lua_State *)global.vm_state;
 
-    lua_getglobal(L, fname);
-    if (lua_isfunction(L, -1)) {
-      tolua_pushusertype(L, (void *)b, TOLUA_CAST "building");
-      if (fparam) {
-        tolua_pushstring(L, fparam);
-      }
+        lua_getglobal(L, fname);
+        if (lua_isfunction(L, -1)) {
+            tolua_pushusertype(L, (void *)b, TOLUA_CAST "building");
+            if (fparam) {
+                tolua_pushstring(L, fparam);
+            }
 
-      if (lua_pcall(L, fparam ? 2 : 1, 1, 0) != 0) {
-        const char *error = lua_tostring(L, -1);
-        log_error("lc_age(%s) calling '%s': %s.\n", buildingname(b), fname, error);
-        lua_pop(L, 1);
-      } else {
-        result = (int)lua_tonumber(L, -1);
-        lua_pop(L, 1);
-      }
-    } else {
-      log_error("lc_age(%s) calling '%s': not a function.\n", buildingname(b), fname);
-      lua_pop(L, 1);
+            if (lua_pcall(L, fparam ? 2 : 1, 1, 0) != 0) {
+                const char *error = lua_tostring(L, -1);
+                log_error("lc_age(%s) calling '%s': %s.\n", buildingname(b), fname, error);
+                lua_pop(L, 1);
+            }
+            else {
+                result = (int)lua_tonumber(L, -1);
+                lua_pop(L, 1);
+            }
+        }
+        else {
+            log_error("lc_age(%s) calling '%s': not a function.\n", buildingname(b), fname);
+            lua_pop(L, 1);
+        }
     }
-  }
-  return (result != 0) ? AT_AGE_KEEP : AT_AGE_REMOVE;
+    return (result != 0) ? AT_AGE_KEEP : AT_AGE_REMOVE;
 }
 
 static const char *NULLSTRING = "(null)";
diff --git a/src/callback.c b/src/callback.c
index 9d76f30c8..79bd69b71 100644
--- a/src/callback.c
+++ b/src/callback.c
@@ -16,7 +16,7 @@ HCALLBACK create_callback(void(*cbv)(va_list va)) {
 }
 
 void reset_callbacks(void) {
-    while(registry) {
+    while (registry) {
         struct reg *r = registry;
         registry = r->next;
         free(r->name);
@@ -38,8 +38,8 @@ HCALLBACK register_callback(const char *name, void(*cbv)(va_list va))
 int find_callback(const char *name, HCALLBACK *result) {
     if (result && name) {
         struct reg *r;
-        for (r=registry;r;r=r->next) {
-            if (strcmp(r->name, name)==0) {
+        for (r = registry; r; r = r->next) {
+            if (strcmp(r->name, name) == 0) {
                 *result = r->cb;
                 return 0;
             }
diff --git a/src/callback.h b/src/callback.h
index f7b0d71ea..288a148e9 100644
--- a/src/callback.h
+++ b/src/callback.h
@@ -4,7 +4,7 @@
 #include <stdarg.h>
 
 typedef struct {
-    void (*cbv)(va_list va);
+    void(*cbv)(va_list va);
 } HCALLBACK;
 
 HCALLBACK register_callback(const char *name, void(*cbv)(va_list va));
diff --git a/src/callback.test.c b/src/callback.test.c
index fbc68ddea..317cc6d50 100644
--- a/src/callback.test.c
+++ b/src/callback.test.c
@@ -43,9 +43,9 @@ static void test_call_by_name(CuTest *tc) {
 
 CuSuite *get_callback_suite(void)
 {
-  CuSuite *suite = CuSuiteNew();
-  SUITE_ADD_TEST(suite, test_find_callback);
-  SUITE_ADD_TEST(suite, test_call_by_name);
-  SUITE_ADD_TEST(suite, test_call_by_handle);
-  return suite;
+    CuSuite *suite = CuSuiteNew();
+    SUITE_ADD_TEST(suite, test_find_callback);
+    SUITE_ADD_TEST(suite, test_call_by_name);
+    SUITE_ADD_TEST(suite, test_call_by_handle);
+    return suite;
 }
diff --git a/src/chaos.c b/src/chaos.c
index 24ee6d0b1..b52f28476 100644
--- a/src/chaos.c
+++ b/src/chaos.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/chaos.h b/src/chaos.h
index 3a131da9e..192c9a8d2 100644
--- a/src/chaos.h
+++ b/src/chaos.h
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2014, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/console.c b/src/console.c
index b850678c5..0c0629de8 100644
--- a/src/console.c
+++ b/src/console.c
@@ -44,20 +44,21 @@
 #define lua_freeline(L,b)	{ (void)L; (void)b; }
 #endif
 
-static int (*my_readline) (lua_State * l, char *, size_t, const char *prompt) =
-  NULL;
+static int(*my_readline) (lua_State * l, char *, size_t, const char *prompt) =
+NULL;
 static int lua_readline(lua_State * l, char *b, const char *prompt)
 {
-  if (my_readline) {
-    return my_readline(l, b, LUA_MAXINPUT, prompt);
-  } else {
-    return default_readline(l, b, prompt);
-  }
+    if (my_readline) {
+        return my_readline(l, b, LUA_MAXINPUT, prompt);
+    }
+    else {
+        return default_readline(l, b, prompt);
+    }
 }
 
 void set_readline(readline foo)
 {
-  my_readline = foo;
+    my_readline = foo;
 }
 
 #ifndef PROMPT
@@ -77,185 +78,185 @@ static const char *progname = "eressea";
 
 static void lstop(lua_State * l, lua_Debug * ar)
 {
-  (void)ar;                     /* unused arg. */
-  lua_sethook(l, NULL, 0, 0);
-  luaL_error(l, "interrupted!");
+    (void)ar;                     /* unused arg. */
+    lua_sethook(l, NULL, 0, 0);
+    luaL_error(l, "interrupted!");
 }
 
 static void laction(int i)
 {
-  signal(i, SIG_DFL);           /* if another SIGINT happens before lstop,
-                                   terminate process (default action) */
-  assert(state_stack_top >= 0 && state_stack_top < STATESTACK_MAX);
-  lua_sethook(state_stack[state_stack_top], lstop,
-    LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1);
+    signal(i, SIG_DFL);           /* if another SIGINT happens before lstop,
+                                     terminate process (default action) */
+    assert(state_stack_top >= 0 && state_stack_top < STATESTACK_MAX);
+    lua_sethook(state_stack[state_stack_top], lstop,
+        LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1);
 }
 
 static void l_message(const char *pname, const char *msg)
 {
-  if (pname)
-    fprintf(stderr, "%s: ", pname);
-  fprintf(stderr, "%s\n", msg);
-  fflush(stderr);
+    if (pname)
+        fprintf(stderr, "%s: ", pname);
+    fprintf(stderr, "%s\n", msg);
+    fflush(stderr);
 }
 
 static int report(lua_State * L, int status)
 {
-  if (status && !lua_isnil(L, -1)) {
-    const char *msg = lua_tostring(L, -1);
-    if (msg == NULL)
-      msg = "(error object is not a string)";
-    l_message(progname, msg);
-    lua_pop(L, 1);
-  }
-  return status;
+    if (status && !lua_isnil(L, -1)) {
+        const char *msg = lua_tostring(L, -1);
+        if (msg == NULL)
+            msg = "(error object is not a string)";
+        l_message(progname, msg);
+        lua_pop(L, 1);
+    }
+    return status;
 }
 
 static int traceback(lua_State * L)
 {
-  lua_getglobal(L, "debug");
-  if (!lua_istable(L, -1)) {
-    lua_pop(L, 1);
+    lua_getglobal(L, "debug");
+    if (!lua_istable(L, -1)) {
+        lua_pop(L, 1);
+        return 1;
+    }
+    lua_getfield(L, -1, "traceback");
+    if (!lua_isfunction(L, -1)) {
+        lua_pop(L, 2);
+        return 1;
+    }
+    lua_pushvalue(L, 1);          /* pass error message */
+    lua_pushinteger(L, 2);        /* skip this function and traceback */
+    lua_call(L, 2, 1);            /* call debug.traceback */
     return 1;
-  }
-  lua_getfield(L, -1, "traceback");
-  if (!lua_isfunction(L, -1)) {
-    lua_pop(L, 2);
-    return 1;
-  }
-  lua_pushvalue(L, 1);          /* pass error message */
-  lua_pushinteger(L, 2);        /* skip this function and traceback */
-  lua_call(L, 2, 1);            /* call debug.traceback */
-  return 1;
 }
 
 static int docall(lua_State * L, int narg, int clear)
 {
-  int status, pop_state = state_stack_top;
-  int base = lua_gettop(L) - narg;      /* function index */
-  lua_pushcfunction(L, traceback);      /* push traceback function */
-  lua_insert(L, base);          /* put it under chunk and args */
-  if (state_stack_top < 0 || L != state_stack[state_stack_top]) {
-    assert(state_stack_top + 1 < STATESTACK_MAX);
-    state_stack[++state_stack_top] = L;
-  }
-  signal(SIGINT, laction);
-  status = lua_pcall(L, narg, (clear ? 0 : LUA_MULTRET), base);
-  signal(SIGINT, SIG_DFL);
-  state_stack_top = pop_state;
-  lua_remove(L, base);          /* remove traceback function */
-  /* force a complete garbage collection in case of errors */
-  if (status != 0)
-    lua_gc(L, LUA_GCCOLLECT, 0);
-  return status;
+    int status, pop_state = state_stack_top;
+    int base = lua_gettop(L) - narg;      /* function index */
+    lua_pushcfunction(L, traceback);      /* push traceback function */
+    lua_insert(L, base);          /* put it under chunk and args */
+    if (state_stack_top < 0 || L != state_stack[state_stack_top]) {
+        assert(state_stack_top + 1 < STATESTACK_MAX);
+        state_stack[++state_stack_top] = L;
+    }
+    signal(SIGINT, laction);
+    status = lua_pcall(L, narg, (clear ? 0 : LUA_MULTRET), base);
+    signal(SIGINT, SIG_DFL);
+    state_stack_top = pop_state;
+    lua_remove(L, base);          /* remove traceback function */
+    /* force a complete garbage collection in case of errors */
+    if (status != 0)
+        lua_gc(L, LUA_GCCOLLECT, 0);
+    return status;
 }
 
 static const char *get_prompt(lua_State * L, int firstline)
 {
-  const char *p = NULL;
-  lua_getglobal(L, firstline ? "_PROMPT" : "_PROMPT2");
-  p = lua_tostring(L, -1);
-  if (p == NULL)
-    p = (firstline ? PROMPT : PROMPT2);
-  lua_pop(L, 1);                /* remove global */
-  return p;
+    const char *p = NULL;
+    lua_getglobal(L, firstline ? "_PROMPT" : "_PROMPT2");
+    p = lua_tostring(L, -1);
+    if (p == NULL)
+        p = (firstline ? PROMPT : PROMPT2);
+    lua_pop(L, 1);                /* remove global */
+    return p;
 }
 
 static int incomplete(lua_State * L, int status)
 {
-  if (status != LUA_ERRSYNTAX)
-    return 0;
-  if (strstr(lua_tostring(L, -1), "near `<eof>'") == NULL)
-    return 0;
+    if (status != LUA_ERRSYNTAX)
+        return 0;
+    if (strstr(lua_tostring(L, -1), "near `<eof>'") == NULL)
+        return 0;
 
-  lua_pop(L, 1);
-  return 1;
+    lua_pop(L, 1);
+    return 1;
 }
 
 static int pushline(lua_State * L, int firstline)
 {
-  char buffer[LUA_MAXINPUT];
-  char *b = buffer;
-  size_t l;
-  const char *prmt = get_prompt(L, firstline);
-  if (lua_readline(L, b, prmt) == 0)
-    return 0;                   /* no input */
-  l = strlen(b);
-  if (l > 0 && b[l - 1] == '\n')        /* line ends with newline? */
-    b[l - 1] = '\0';            /* remove it */
-  if (firstline && b[0] == '=') /* first line starts with `=' ? */
-    lua_pushfstring(L, "return %s", b + 1);     /* change it to `return' */
-  else
-    lua_pushstring(L, b);
-  lua_freeline(L, b);
-  return 1;
+    char buffer[LUA_MAXINPUT];
+    char *b = buffer;
+    size_t l;
+    const char *prmt = get_prompt(L, firstline);
+    if (lua_readline(L, b, prmt) == 0)
+        return 0;                   /* no input */
+    l = strlen(b);
+    if (l > 0 && b[l - 1] == '\n')        /* line ends with newline? */
+        b[l - 1] = '\0';            /* remove it */
+    if (firstline && b[0] == '=') /* first line starts with `=' ? */
+        lua_pushfstring(L, "return %s", b + 1);     /* change it to `return' */
+    else
+        lua_pushstring(L, b);
+    lua_freeline(L, b);
+    return 1;
 }
 
 static int loadline(lua_State * L)
 {
-  int status;
-  lua_settop(L, 0);
-  if (!pushline(L, 1))
-    return -1;                  /* no input */
-  for (;;) {                    /* repeat until gets a complete line */
-    status = luaL_loadbuffer(L, lua_tostring(L, 1), lua_strlen(L, 1), "=stdin");
-    if (!incomplete(L, status))
-      break;                    /* cannot try to add lines? */
-    if (!pushline(L, 0))        /* no more input? */
-      return -1;
-    lua_pushliteral(L, "\n");   /* add a new line... */
-    lua_insert(L, -2);          /* ...between the two lines */
-    lua_concat(L, 3);           /* join them */
-  }
-  lua_saveline(L, 1);
-  lua_remove(L, 1);             /* remove line */
-  return status;
+    int status;
+    lua_settop(L, 0);
+    if (!pushline(L, 1))
+        return -1;                  /* no input */
+    for (;;) {                    /* repeat until gets a complete line */
+        status = luaL_loadbuffer(L, lua_tostring(L, 1), lua_strlen(L, 1), "=stdin");
+        if (!incomplete(L, status))
+            break;                    /* cannot try to add lines? */
+        if (!pushline(L, 0))        /* no more input? */
+            return -1;
+        lua_pushliteral(L, "\n");   /* add a new line... */
+        lua_insert(L, -2);          /* ...between the two lines */
+        lua_concat(L, 3);           /* join them */
+    }
+    lua_saveline(L, 1);
+    lua_remove(L, 1);             /* remove line */
+    return status;
 }
 
 static void dotty(lua_State * L)
 {
-  int status;
-  const char *oldprogname = progname;
-  progname = NULL;
-  while ((status = loadline(L)) != -1) {
-    if (status == 0)
-      status = docall(L, 0, 0);
-    report(L, status);
-    if (status == 0 && lua_gettop(L) > 0) {     /* any result to print? */
-      lua_getglobal(L, "print");
-      lua_insert(L, 1);
-      if (lua_pcall(L, lua_gettop(L) - 1, 0, 0) != 0)
-        l_message(progname, lua_pushfstring(L,
-            "error calling " LUA_QL("print") " (%s)", lua_tostring(L, -1)));
+    int status;
+    const char *oldprogname = progname;
+    progname = NULL;
+    while ((status = loadline(L)) != -1) {
+        if (status == 0)
+            status = docall(L, 0, 0);
+        report(L, status);
+        if (status == 0 && lua_gettop(L) > 0) {     /* any result to print? */
+            lua_getglobal(L, "print");
+            lua_insert(L, 1);
+            if (lua_pcall(L, lua_gettop(L) - 1, 0, 0) != 0)
+                l_message(progname, lua_pushfstring(L,
+                "error calling " LUA_QL("print") " (%s)", lua_tostring(L, -1)));
+        }
     }
-  }
-  lua_settop(L, 0);             /* clear stack */
-  fputs("\n", stdout);
-  fflush(stdout);
-  progname = oldprogname;
+    lua_settop(L, 0);             /* clear stack */
+    fputs("\n", stdout);
+    fflush(stdout);
+    progname = oldprogname;
 }
 
 int lua_console(lua_State * L)
 {
-  dotty(L);
-  return 0;
+    dotty(L);
+    return 0;
 }
 
 int lua_do(lua_State * L)
 {
-  int status = loadline(L);
-  if (status != -1) {
-    if (status == 0)
-      status = docall(L, 0, 0);
-    report(L, status);
-    if (status == 0 && lua_gettop(L) > 0) {     /* any result to print? */
-      lua_getglobal(L, "print");
-      lua_insert(L, 1);
-      if (lua_pcall(L, lua_gettop(L) - 1, 0, 0) != 0)
-        l_message(NULL, lua_pushfstring(L, "error calling `print' (%s)",
-            lua_tostring(L, -1)));
+    int status = loadline(L);
+    if (status != -1) {
+        if (status == 0)
+            status = docall(L, 0, 0);
+        report(L, status);
+        if (status == 0 && lua_gettop(L) > 0) {     /* any result to print? */
+            lua_getglobal(L, "print");
+            lua_insert(L, 1);
+            if (lua_pcall(L, lua_gettop(L) - 1, 0, 0) != 0)
+                l_message(NULL, lua_pushfstring(L, "error calling `print' (%s)",
+                lua_tostring(L, -1)));
+        }
     }
-  }
-  lua_settop(L, 0);             /* clear stack */
-  return 0;
+    lua_settop(L, 0);             /* clear stack */
+    return 0;
 }
diff --git a/src/console.h b/src/console.h
index 8afdeb0d0..03c7dddb6 100644
--- a/src/console.h
+++ b/src/console.h
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
                          Katja Zedel <katze@felidae.kn-bremen.de
                          Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/creport.c b/src/creport.c
index 7d0963165..466397adf 100644
--- a/src/creport.c
+++ b/src/creport.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/*
 +-------------------+  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Christian Schlittchen <corwin@amber.kn-bremen.de>
 | (c) 1998 - 2008   |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -525,23 +525,23 @@ static int fwritestr(FILE * F, const char *str)
     fputc('\"', F);
     if (str)
         while (*str) {
-        int c = (int)(unsigned char)*str++;
-        switch (c) {
-        case '"':
-        case '\\':
-            fputc('\\', F);
-            fputc(c, F);
-            nwrite += 2;
-            break;
-        case '\n':
-            fputc('\\', F);
-            fputc('n', F);
-            nwrite += 2;
-            break;
-        default:
-            fputc(c, F);
-            ++nwrite;
-        }
+            int c = (int)(unsigned char)*str++;
+            switch (c) {
+            case '"':
+            case '\\':
+                fputc('\\', F);
+                fputc(c, F);
+                nwrite += 2;
+                break;
+            case '\n':
+                fputc('\\', F);
+                fputc('n', F);
+                nwrite += 2;
+                break;
+            default:
+                fputc(c, F);
+                ++nwrite;
+            }
         }
     fputc('\"', F);
     return nwrite + 2;
@@ -825,183 +825,183 @@ static void cr_output_unit(FILE * F, const region * r, const faction * f,
               prefix)));
       }
   }
-    if (u->faction != f && a_fshidden
-        && a_fshidden->data.ca[0] == 1 && effskill(u, SK_STEALTH) >= 6) {
-        fprintf(F, "-1;Anzahl\n");
-    }
-    else {
-        fprintf(F, "%d;Anzahl\n", u->number);
-    }
+  if (u->faction != f && a_fshidden
+      && a_fshidden->data.ca[0] == 1 && effskill(u, SK_STEALTH) >= 6) {
+      fprintf(F, "-1;Anzahl\n");
+  }
+  else {
+      fprintf(F, "%d;Anzahl\n", u->number);
+  }
 
-    pzTmp = get_racename(u->attribs);
-    if (pzTmp) {
-        fprintf(F, "\"%s\";Typ\n", pzTmp);
-        if (u->faction == f && fval(u_race(u), RCF_SHAPESHIFTANY)) {
-            const char *zRace = rc_name_s(u_race(u), NAME_PLURAL);
-            fprintf(F, "\"%s\";wahrerTyp\n",
-                translate(zRace, LOC(f->locale, zRace)));
-        }
-    }
-    else {
-        const race *irace = u_irace(u);
-        const char *zRace = rc_name_s(irace, NAME_PLURAL);
-        fprintf(F, "\"%s\";Typ\n",
-            translate(zRace, LOC(f->locale, zRace)));
-        if (u->faction == f && irace != u_race(u)) {
-            assert(skill_enabled(SK_STEALTH)
-                || !"we're resetting this on load, so.. ircase should never be used");
-            zRace = rc_name_s(u_race(u), NAME_PLURAL);
-            fprintf(F, "\"%s\";wahrerTyp\n",
-                translate(zRace, LOC(f->locale, zRace)));
-        }
-    }
+  pzTmp = get_racename(u->attribs);
+  if (pzTmp) {
+      fprintf(F, "\"%s\";Typ\n", pzTmp);
+      if (u->faction == f && fval(u_race(u), RCF_SHAPESHIFTANY)) {
+          const char *zRace = rc_name_s(u_race(u), NAME_PLURAL);
+          fprintf(F, "\"%s\";wahrerTyp\n",
+              translate(zRace, LOC(f->locale, zRace)));
+      }
+  }
+  else {
+      const race *irace = u_irace(u);
+      const char *zRace = rc_name_s(irace, NAME_PLURAL);
+      fprintf(F, "\"%s\";Typ\n",
+          translate(zRace, LOC(f->locale, zRace)));
+      if (u->faction == f && irace != u_race(u)) {
+          assert(skill_enabled(SK_STEALTH)
+              || !"we're resetting this on load, so.. ircase should never be used");
+          zRace = rc_name_s(u_race(u), NAME_PLURAL);
+          fprintf(F, "\"%s\";wahrerTyp\n",
+              translate(zRace, LOC(f->locale, zRace)));
+      }
+  }
 
-    if (u->building) {
-        assert(u->building->region);
-        fprintf(F, "%d;Burg\n", u->building->no);
-    }
-    if (u->ship) {
-        assert(u->ship->region);
-        fprintf(F, "%d;Schiff\n", u->ship->no);
-    }
-    if (is_guard(u, GUARD_ALL) != 0) {
-        fprintf(F, "%d;bewacht\n", 1);
-    }
-    if ((b = usiege(u)) != NULL) {
-        fprintf(F, "%d;belagert\n", b->no);
-    }
-    /* additional information for own units */
-    if (u->faction == f || omniscient(f)) {
-        order *ord;
-        const char *xc;
-        const char *c;
-        int i;
-        sc_mage *mage;
+  if (u->building) {
+      assert(u->building->region);
+      fprintf(F, "%d;Burg\n", u->building->no);
+  }
+  if (u->ship) {
+      assert(u->ship->region);
+      fprintf(F, "%d;Schiff\n", u->ship->no);
+  }
+  if (is_guard(u, GUARD_ALL) != 0) {
+      fprintf(F, "%d;bewacht\n", 1);
+  }
+  if ((b = usiege(u)) != NULL) {
+      fprintf(F, "%d;belagert\n", b->no);
+  }
+  /* additional information for own units */
+  if (u->faction == f || omniscient(f)) {
+      order *ord;
+      const char *xc;
+      const char *c;
+      int i;
+      sc_mage *mage;
 
-        i = ualias(u);
-        if (i > 0)
-            fprintf(F, "%d;temp\n", i);
-        else if (i < 0)
-            fprintf(F, "%d;alias\n", -i);
-        i = get_money(u);
-        fprintf(F, "%d;Kampfstatus\n", u->status);
-        fprintf(F, "%d;weight\n", weight(u));
-        if (fval(u, UFL_NOAID)) {
-            fputs("1;unaided\n", F);
-        }
-        if (fval(u, UFL_STEALTH)) {
-            i = u_geteffstealth(u);
-            if (i >= 0) {
-                fprintf(F, "%d;Tarnung\n", i);
-            }
-        }
-        xc = uprivate(u);
-        if (xc) {
-            fprintf(F, "\"%s\";privat\n", xc);
-        }
-        c = hp_status(u);
-        if (c && *c && (u->faction == f || omniscient(f))) {
-            fprintf(F, "\"%s\";hp\n", translate(c,
-                LOC(u->faction->locale, c)));
-        }
-        if (fval(u, UFL_HERO)) {
-            fputs("1;hero\n", F);
-        }
+      i = ualias(u);
+      if (i > 0)
+          fprintf(F, "%d;temp\n", i);
+      else if (i < 0)
+          fprintf(F, "%d;alias\n", -i);
+      i = get_money(u);
+      fprintf(F, "%d;Kampfstatus\n", u->status);
+      fprintf(F, "%d;weight\n", weight(u));
+      if (fval(u, UFL_NOAID)) {
+          fputs("1;unaided\n", F);
+      }
+      if (fval(u, UFL_STEALTH)) {
+          i = u_geteffstealth(u);
+          if (i >= 0) {
+              fprintf(F, "%d;Tarnung\n", i);
+          }
+      }
+      xc = uprivate(u);
+      if (xc) {
+          fprintf(F, "\"%s\";privat\n", xc);
+      }
+      c = hp_status(u);
+      if (c && *c && (u->faction == f || omniscient(f))) {
+          fprintf(F, "\"%s\";hp\n", translate(c,
+              LOC(u->faction->locale, c)));
+      }
+      if (fval(u, UFL_HERO)) {
+          fputs("1;hero\n", F);
+      }
 
-        if (fval(u, UFL_HUNGER) && (u->faction == f)) {
-            fputs("1;hunger\n", F);
-        }
-        if (is_mage(u)) {
-            fprintf(F, "%d;Aura\n", get_spellpoints(u));
-            fprintf(F, "%d;Auramax\n", max_spellpoints(u->region, u));
-        }
-        /* default commands */
-        fprintf(F, "COMMANDS\n");
-        for (ord = u->old_orders; ord; ord = ord->next) {
-            /* this new order will replace the old defaults */
-            if (is_persistent(ord)) {
-                fwriteorder(F, ord, f->locale, true);
-                fputc('\n', F);
-            }
-        }
-        for (ord = u->orders; ord; ord = ord->next) {
-            if (u->old_orders && is_repeated(ord))
-                continue;               /* unit has defaults */
-            if (is_persistent(ord)) {
-                fwriteorder(F, ord, f->locale, true);
-                fputc('\n', F);
-            }
-        }
+      if (fval(u, UFL_HUNGER) && (u->faction == f)) {
+          fputs("1;hunger\n", F);
+      }
+      if (is_mage(u)) {
+          fprintf(F, "%d;Aura\n", get_spellpoints(u));
+          fprintf(F, "%d;Auramax\n", max_spellpoints(u->region, u));
+      }
+      /* default commands */
+      fprintf(F, "COMMANDS\n");
+      for (ord = u->old_orders; ord; ord = ord->next) {
+          /* this new order will replace the old defaults */
+          if (is_persistent(ord)) {
+              fwriteorder(F, ord, f->locale, true);
+              fputc('\n', F);
+          }
+      }
+      for (ord = u->orders; ord; ord = ord->next) {
+          if (u->old_orders && is_repeated(ord))
+              continue;               /* unit has defaults */
+          if (is_persistent(ord)) {
+              fwriteorder(F, ord, f->locale, true);
+              fputc('\n', F);
+          }
+      }
 
-        /* talents */
-        pr = 0;
-        for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
-            if (sv->level > 0) {
-                skill_t sk = sv->id;
-                int esk = eff_skill(u, sk, r);
-                if (!pr) {
-                    pr = 1;
-                    fprintf(F, "TALENTE\n");
-                }
-                fprintf(F, "%d %d;%s\n", u->number * level_days(sv->level), esk,
-                    translate(mkname("skill", skillnames[sk]), skillname(sk,
-                    f->locale)));
-            }
-        }
+      /* talents */
+      pr = 0;
+      for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
+          if (sv->level > 0) {
+              skill_t sk = sv->id;
+              int esk = eff_skill(u, sk, r);
+              if (!pr) {
+                  pr = 1;
+                  fprintf(F, "TALENTE\n");
+              }
+              fprintf(F, "%d %d;%s\n", u->number * level_days(sv->level), esk,
+                  translate(mkname("skill", skillnames[sk]), skillname(sk,
+                  f->locale)));
+          }
+      }
 
-        /* spells that this unit can cast */
-        mage = get_mage(u);
-        if (mage) {
-            int i, maxlevel = effskill(u, SK_MAGIC);
-            cr_output_spells(F, u, maxlevel);
+      /* spells that this unit can cast */
+      mage = get_mage(u);
+      if (mage) {
+          int i, maxlevel = effskill(u, SK_MAGIC);
+          cr_output_spells(F, u, maxlevel);
 
-            for (i = 0; i != MAXCOMBATSPELLS; ++i) {
-                const spell *sp = mage->combatspells[i].sp;
-                if (sp) {
-                    const char *name =
-                        translate(mkname("spell", sp->sname), spell_name(sp,
-                        f->locale));
-                    fprintf(F, "KAMPFZAUBER %d\n", i);
-                    fprintf(F, "\"%s\";name\n", name);
-                    fprintf(F, "%d;level\n", mage->combatspells[i].level);
-                }
-            }
-        }
-    }
-    /* items */
-    pr = 0;
-    if (f == u->faction || omniscient(f)) {
-        show = u->items;
-    }
-    else if (!itemcloak && mode >= see_unit && !(a_fshidden
-        && a_fshidden->data.ca[1] == 1 && effskill(u, SK_STEALTH) >= 3)) {
-        int n = report_items(u->items, result, MAX_INVENTORY, u, f);
-        assert(n >= 0);
-        if (n > 0)
-            show = result;
-        else
-            show = NULL;
-    }
-    else {
-        show = NULL;
-    }
-    lasttype = NULL;
-    for (itm = show; itm; itm = itm->next) {
-        const char *ic;
-        int in;
-        assert(itm->type != lasttype
-            || !"error: list contains two objects of the same item");
-        report_item(u, itm, f, NULL, &ic, &in, true);
-        if (in == 0)
-            continue;
-        if (!pr) {
-            pr = 1;
-            fputs("GEGENSTAENDE\n", F);
-        }
-        fprintf(F, "%d;%s\n", in, translate(ic, LOC(f->locale, ic)));
-    }
+          for (i = 0; i != MAXCOMBATSPELLS; ++i) {
+              const spell *sp = mage->combatspells[i].sp;
+              if (sp) {
+                  const char *name =
+                      translate(mkname("spell", sp->sname), spell_name(sp,
+                      f->locale));
+                  fprintf(F, "KAMPFZAUBER %d\n", i);
+                  fprintf(F, "\"%s\";name\n", name);
+                  fprintf(F, "%d;level\n", mage->combatspells[i].level);
+              }
+          }
+      }
+  }
+  /* items */
+  pr = 0;
+  if (f == u->faction || omniscient(f)) {
+      show = u->items;
+  }
+  else if (!itemcloak && mode >= see_unit && !(a_fshidden
+      && a_fshidden->data.ca[1] == 1 && effskill(u, SK_STEALTH) >= 3)) {
+      int n = report_items(u->items, result, MAX_INVENTORY, u, f);
+      assert(n >= 0);
+      if (n > 0)
+          show = result;
+      else
+          show = NULL;
+  }
+  else {
+      show = NULL;
+  }
+  lasttype = NULL;
+  for (itm = show; itm; itm = itm->next) {
+      const char *ic;
+      int in;
+      assert(itm->type != lasttype
+          || !"error: list contains two objects of the same item");
+      report_item(u, itm, f, NULL, &ic, &in, true);
+      if (in == 0)
+          continue;
+      if (!pr) {
+          pr = 1;
+          fputs("GEGENSTAENDE\n", F);
+      }
+      fprintf(F, "%d;%s\n", in, translate(ic, LOC(f->locale, ic)));
+  }
 
-    cr_output_curses(F, f, u, TYP_UNIT);
+  cr_output_curses(F, f, u, TYP_UNIT);
 }
 
 /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =  */
@@ -1011,12 +1011,12 @@ static void show_allies_cr(FILE * F, const faction * f, const ally * sf)
 {
     for (; sf; sf = sf->next)
         if (sf->faction) {
-        int mode = alliedgroup(NULL, f, sf->faction, sf, HELP_ALL);
-        if (mode != 0 && sf->status > 0) {
-            fprintf(F, "ALLIANZ %d\n", sf->faction->no);
-            fprintf(F, "\"%s\";Parteiname\n", sf->faction->name);
-            fprintf(F, "%d;Status\n", sf->status & HELP_ALL);
-        }
+            int mode = alliedgroup(NULL, f, sf->faction, sf, HELP_ALL);
+            if (mode != 0 && sf->status > 0) {
+                fprintf(F, "ALLIANZ %d\n", sf->faction->no);
+                fprintf(F, "\"%s\";Parteiname\n", sf->faction->name);
+                fprintf(F, "%d;Status\n", sf->status & HELP_ALL);
+            }
         }
 }
 
diff --git a/src/creport.h b/src/creport.h
index 1f3145b4f..678f09ada 100644
--- a/src/creport.h
+++ b/src/creport.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -6,21 +6,19 @@
  |                   |  Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
  +-------------------+  Stefan Reich <reich@halbling.de>
 
- This program may not be used, modified or distributed 
+ This program may not be used, modified or distributed
  without prior permission by the authors of Eressea.
-*/
+ */
 #ifndef H_GC_CREPORT
 #define H_GC_CREPORT
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#include <time.h>
+    void creport_cleanup(void);
+    void register_cr(void);
 
-  extern void creport_cleanup(void);
-  extern void register_cr(void);
-
-  extern int crwritemap(const char *filename);
+    int crwritemap(const char *filename);
 
 #ifdef __cplusplus
 }
diff --git a/src/direction.c b/src/direction.c
index 66603663c..0b9bb8206 100644
--- a/src/direction.c
+++ b/src/direction.c
@@ -23,17 +23,17 @@ void init_directions(struct locale *lang) {
         direction_t direction;
     } dirs[] = {
         { "dir_ne", D_NORTHEAST },
-        { "dir_nw", D_NORTHWEST }, 
-        { "dir_se", D_SOUTHEAST }, 
-        { "dir_sw", D_SOUTHWEST }, 
-        { "dir_east", D_EAST }, 
-        { "dir_west", D_WEST }, 
+        { "dir_nw", D_NORTHWEST },
+        { "dir_se", D_SOUTHEAST },
+        { "dir_sw", D_SOUTHWEST },
+        { "dir_east", D_EAST },
+        { "dir_west", D_WEST },
         { "northeast", D_NORTHEAST },
         { "northwest", D_NORTHWEST },
         { "southeast", D_SOUTHEAST },
         { "southwest", D_SOUTHWEST },
         { "east", D_EAST },
-        { "west", D_WEST }, 
+        { "west", D_WEST },
         { "PAUSE", D_PAUSE },
         { NULL, NODIRECTION }
     };
@@ -47,7 +47,7 @@ void init_directions(struct locale *lang) {
         if (str) {
             variant token;
             token.i = dirs[i].direction;
-            addtoken(tokens, str, token); 
+            addtoken(tokens, str, token);
         }
     }
 }
@@ -65,15 +65,15 @@ direction_t get_direction(const char *s, const struct locale *lang)
 
 direction_t finddirection(const char *str) {
     int i;
-    for (i=0;i!=MAXDIRECTIONS+2;++i) {
-        if (directions[i] && strcmp(str, directions[i])==0) {
+    for (i = 0; i != MAXDIRECTIONS + 2; ++i) {
+        if (directions[i] && strcmp(str, directions[i]) == 0) {
             return (direction_t)i;
         }
     }
     return NODIRECTION;
 }
 
-const char * directions[MAXDIRECTIONS+2] = {
-"northwest", "northeast", "east", "southeast", "southwest", "west", 0, "pause"
+const char * directions[MAXDIRECTIONS + 2] = {
+    "northwest", "northeast", "east", "southeast", "southwest", "west", 0, "pause"
 };
 
diff --git a/src/direction.h b/src/direction.h
index aa32046a0..8f0932aaf 100644
--- a/src/direction.h
+++ b/src/direction.h
@@ -6,28 +6,28 @@ extern "C"
 {
 #endif
 
-struct locale;
+    struct locale;
 
-typedef enum {
-    D_NORTHWEST,
-    D_NORTHEAST,
-    D_EAST,
-    D_SOUTHEAST,
-    D_SOUTHWEST,
-    D_WEST,
-    MAXDIRECTIONS,
-    D_PAUSE,
-    D_SPECIAL,
-    NODIRECTION = -1
-} direction_t; 
+    typedef enum {
+        D_NORTHWEST,
+        D_NORTHEAST,
+        D_EAST,
+        D_SOUTHEAST,
+        D_SOUTHWEST,
+        D_WEST,
+        MAXDIRECTIONS,
+        D_PAUSE,
+        D_SPECIAL,
+        NODIRECTION = -1
+    } direction_t;
 
-direction_t get_direction(const char *s, const struct locale *);
-void init_directions(struct locale *lang);
-void init_direction(const struct locale *lang, direction_t dir, const char *str);
+    direction_t get_direction(const char *s, const struct locale *);
+    void init_directions(struct locale *lang);
+    void init_direction(const struct locale *lang, direction_t dir, const char *str);
 
-direction_t finddirection(const char *str);
+    direction_t finddirection(const char *str);
 
-extern const char * directions[];
+    extern const char * directions[];
 
 #ifdef __cplusplus
 #endif
diff --git a/src/direction.test.c b/src/direction.test.c
index 66b854f5a..54ae5a6bb 100644
--- a/src/direction.test.c
+++ b/src/direction.test.c
@@ -61,11 +61,11 @@ static void test_get_direction_default(CuTest *tc) {
 
 CuSuite *get_direction_suite(void)
 {
-  CuSuite *suite = CuSuiteNew();
-  SUITE_ADD_TEST(suite, test_init_direction);
-  SUITE_ADD_TEST(suite, test_init_directions);
-  SUITE_ADD_TEST(suite, test_finddirection);
-  SUITE_DISABLE_TEST(suite, test_get_direction_default);
-  return suite;
+    CuSuite *suite = CuSuiteNew();
+    SUITE_ADD_TEST(suite, test_init_direction);
+    SUITE_ADD_TEST(suite, test_init_directions);
+    SUITE_ADD_TEST(suite, test_finddirection);
+    SUITE_DISABLE_TEST(suite, test_get_direction_default);
+    return suite;
 }
 
diff --git a/src/economy.c b/src/economy.c
index 886f2a210..5eedbfa9c 100644
--- a/src/economy.c
+++ b/src/economy.c
@@ -517,8 +517,8 @@ static void recruit(unit * u, struct order *ord, request ** recruitorders)
 
             for (u2 = r->units; u2; u2 = u2->next)
                 if (fval(u2, UFL_WARMTH)) {
-                usepotion = true;
-                break;
+                    usepotion = true;
+                    break;
                 }
             if (!usepotion)
 #endif
@@ -1282,23 +1282,23 @@ leveled_allocation(const resource_type * rtype, region * r, allocation * alist)
 
             for (al = alist; al; al = al->next)
                 if (!fval(al, AFL_DONE)) {
-                int req = required(al->want - al->get, al->save);
-                assert(al->get <= al->want && al->get >= 0);
-                if (eff_skill(al->unit, itype->construction->skill, r)
-                    >= rm->level + itype->construction->minskill - 1) {
-                    if (req) {
-                        norders += req;
+                    int req = required(al->want - al->get, al->save);
+                    assert(al->get <= al->want && al->get >= 0);
+                    if (eff_skill(al->unit, itype->construction->skill, r)
+                        >= rm->level + itype->construction->minskill - 1) {
+                        if (req) {
+                            norders += req;
+                        }
+                        else {
+                            fset(al, AFL_DONE);
+                        }
                     }
                     else {
                         fset(al, AFL_DONE);
+                        if (first)
+                            fset(al, AFL_LOWSKILL);
                     }
                 }
-                else {
-                    fset(al, AFL_DONE);
-                    if (first)
-                        fset(al, AFL_LOWSKILL);
-                }
-                }
             need = norders;
 
             avail = _min(avail, norders);
@@ -1306,18 +1306,18 @@ leveled_allocation(const resource_type * rtype, region * r, allocation * alist)
                 int use = 0;
                 for (al = alist; al; al = al->next)
                     if (!fval(al, AFL_DONE)) {
-                    if (avail > 0) {
-                        int want = required(al->want - al->get, al->save);
-                        int x = avail * want / norders;
-                        /* Wenn Rest, dann w�rfeln, ob ich was bekomme: */
-                        if (rng_int() % norders < (avail * want) % norders)
-                            ++x;
-                        avail -= x;
-                        use += x;
-                        norders -= want;
-                        need -= x;
-                        al->get = _min(al->want, al->get + (int)(x / al->save));
-                    }
+                        if (avail > 0) {
+                            int want = required(al->want - al->get, al->save);
+                            int x = avail * want / norders;
+                            /* Wenn Rest, dann w�rfeln, ob ich was bekomme: */
+                            if (rng_int() % norders < (avail * want) % norders)
+                                ++x;
+                            avail -= x;
+                            use += x;
+                            norders -= want;
+                            need -= x;
+                            al->get = _min(al->want, al->get + (int)(x / al->save));
+                        }
                     }
                 if (use) {
                     assert(use <= rm->amount);
@@ -2917,16 +2917,16 @@ static void expandloot(region * r, request * lootorders)
         looted = looted + TAXFRACTION * 2;
     }
     free(oa);
-    
+
     /* Lowering morale by 1 depending on the looted money (+20%) */
     if (rng_int() % 100 < ((looted / startmoney) + 0.2)) {
         int m = region_get_morale(r);
         if (m) {
             /*Nur Moral -1, turns is not changed, so the first time nothing happens if the morale is good*/
-            region_set_morale(r, m-1, -1);
+            region_set_morale(r, m - 1, -1);
         }
     }
-    
+
     for (u = r->units; u; u = u->next) {
         if (u->n >= 0) {
             add_income(u, IC_LOOT, u->wants, u->n);
diff --git a/src/economy.h b/src/economy.h
index 92512b8e9..033855567 100644
--- a/src/economy.h
+++ b/src/economy.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,22 +22,22 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-/* Welchen Teil des Silbers die Bauern fuer Unterhaltung ausgeben (1/20), und
- * wiviel Silber ein Unterhalter pro Talentpunkt bekommt. */
+    /* Welchen Teil des Silbers die Bauern fuer Unterhaltung ausgeben (1/20), und
+     * wiviel Silber ein Unterhalter pro Talentpunkt bekommt. */
 
-/* Wieviele Silbermuenzen jeweils auf einmal "getaxed" werden. */
+    /* Wieviele Silbermuenzen jeweils auf einmal "getaxed" werden. */
 
 #define TAXFRACTION             10
 
-/* Wieviel Silber pro Talentpunkt geklaut wird. */
+    /* Wieviel Silber pro Talentpunkt geklaut wird. */
 
 #define STEALINCOME             50
 
-/* Teil der Bauern, welche Luxusgueter kaufen und verkaufen (1/100). */
+    /* Teil der Bauern, welche Luxusgueter kaufen und verkaufen (1/100). */
 
 #define TRADE_FRACTION          100
 
-/* Wieviel Fremde eine Partei pro Woche aufnehmen kann */
+    /* Wieviel Fremde eine Partei pro Woche aufnehmen kann */
 #define MAXNEWBIES								5
 
     struct unit;
@@ -54,12 +54,12 @@ extern "C" {
 
     enum { IC_WORK, IC_ENTERTAIN, IC_TAX, IC_TRADE, IC_TRADETAX, IC_STEAL, IC_MAGIC, IC_LOOT };
     void maintain_buildings(struct region *r, bool crash);
-    extern void add_spende(struct faction *f1, struct faction *f2, int betrag, struct region *r);
-    extern int make_cmd(struct unit *u, struct order *ord);
-    extern void split_allocations(struct region *r);
-    extern int recruit_archetypes(void);
-    extern int give_control_cmd(struct unit *u, struct order *ord);
-    extern void give_control(struct unit * u, struct unit * u2);
+    void add_spende(struct faction *f1, struct faction *f2, int betrag, struct region *r);
+    int make_cmd(struct unit *u, struct order *ord);
+    void split_allocations(struct region *r);
+    int recruit_archetypes(void);
+    int give_control_cmd(struct unit *u, struct order *ord);
+    void give_control(struct unit * u, struct unit * u2);
 
     struct message * check_steal(const struct unit * u, struct order *ord);
 
diff --git a/src/eressea.h b/src/eressea.h
index 3944bb090..f3ea4d4a5 100755
--- a/src/eressea.h
+++ b/src/eressea.h
@@ -4,8 +4,8 @@
 extern "C" {
 #endif
 
-  void game_init(void);
-  void game_done(void);
+    void game_init(void);
+    void game_done(void);
 
 #ifdef __cplusplus
 }
diff --git a/src/give.c b/src/give.c
index 913226bb4..7b9d2a3fb 100644
--- a/src/give.c
+++ b/src/give.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/*
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
diff --git a/src/give.h b/src/give.h
index 7a579d3df..9c06e89ca 100644
--- a/src/give.h
+++ b/src/give.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/*
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -6,7 +6,7 @@
  |                   |  Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
  +-------------------+  Stefan Reich <reich@halbling.de>
 
- This program may not be used, modified or distributed 
+ This program may not be used, modified or distributed
  without prior permission by the authors of Eressea.
 
  */
@@ -21,15 +21,15 @@ extern "C" {
     struct unit;
     struct message;
 
-  int give_item(int want, const struct item_type *itype,
+    int give_item(int want, const struct item_type *itype,
     struct unit *src, struct unit *dest, struct order *ord);
-  struct message * disband_men(int n, struct unit * u, struct order *ord);
-  struct message * give_men(int n, struct unit *u, struct unit *u2,
+    struct message * disband_men(int n, struct unit * u, struct order *ord);
+    struct message * give_men(int n, struct unit *u, struct unit *u2,
     struct order *ord);
-  void give_unit(struct unit *u, struct unit *u2, struct order *ord);
-  void give_cmd(struct unit * u, struct order * ord);
-  struct message * check_give(const struct unit * u, const struct unit * u2, struct order *ord);
-  bool can_give_to(struct unit *u, struct unit *u2);
+    void give_unit(struct unit *u, struct unit *u2, struct order *ord);
+    void give_cmd(struct unit * u, struct order * ord);
+    struct message * check_give(const struct unit * u, const struct unit * u2, struct order *ord);
+    bool can_give_to(struct unit *u, struct unit *u2);
 
 #ifdef __cplusplus
 }
diff --git a/src/gmtool.c b/src/gmtool.c
index ff1bc556d..e92299f2b 100644
--- a/src/gmtool.c
+++ b/src/gmtool.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  * +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  * |                   |  Enno Rehling <enno@eressea.de>
  * | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -77,481 +77,488 @@ static WINDOW *hstatus;
 
 static void init_curses(void)
 {
-  short fg, bg;
-  initscr();
+    short fg, bg;
+    initscr();
 
-  if (has_colors() || force_color) {
-    short bcol = COLOR_BLACK;
-    short hcol = COLOR_MAGENTA;
-    start_color();
+    if (has_colors() || force_color) {
+        short bcol = COLOR_BLACK;
+        short hcol = COLOR_MAGENTA;
+        start_color();
 #ifdef WIN32
-    /* looks crap on putty with TERM=linux */
-    if (can_change_color()) {
-      init_color(COLOR_YELLOW, 1000, 1000, 0);
-      init_color(COLOR_CYAN, 0, 1000, 1000);
-    }
+        /* looks crap on putty with TERM=linux */
+        if (can_change_color()) {
+            init_color(COLOR_YELLOW, 1000, 1000, 0);
+            init_color(COLOR_CYAN, 0, 1000, 1000);
+        }
 #endif
-    for (fg = 0; fg != 8; ++fg) {
-      for (bg = 0; bg != 2; ++bg) {
-        init_pair(fg + 8 * bg, fg, bg ? hcol : bcol);
-      }
+        for (fg = 0; fg != 8; ++fg) {
+            for (bg = 0; bg != 2; ++bg) {
+                init_pair(fg + 8 * bg, fg, bg ? hcol : bcol);
+            }
+        }
+
+        attrset(COLOR_PAIR(COLOR_BLACK));
+        bkgd(' ' | COLOR_PAIR(COLOR_BLACK));
+        bkgdset(' ' | COLOR_PAIR(COLOR_BLACK));
     }
 
-    attrset(COLOR_PAIR(COLOR_BLACK));
-    bkgd(' ' | COLOR_PAIR(COLOR_BLACK));
-    bkgdset(' ' | COLOR_PAIR(COLOR_BLACK));
-  }
-
-  keypad(stdscr, TRUE);         /* enable keyboard mapping */
-  meta(stdscr, TRUE);
-  nonl();                       /* tell curses not to do NL->CR/NL on output */
-  cbreak();                     /* take input chars one at a time, no wait for \n */
-  noecho();                     /* don't echo input */
-  scrollok(stdscr, FALSE);
-  refresh();
+    keypad(stdscr, TRUE);         /* enable keyboard mapping */
+    meta(stdscr, TRUE);
+    nonl();                       /* tell curses not to do NL->CR/NL on output */
+    cbreak();                     /* take input chars one at a time, no wait for \n */
+    noecho();                     /* don't echo input */
+    scrollok(stdscr, FALSE);
+    refresh();
 }
 
 void cnormalize(const coordinate * c, int *x, int *y)
 {
-  *x = c->x;
-  *y = c->y;
-  pnormalize(x, y, c->pl);
+    *x = c->x;
+    *y = c->y;
+    pnormalize(x, y, c->pl);
 }
 
 map_region *mr_get(const view * vi, int xofs, int yofs)
 {
-  return vi->regions + xofs + yofs * vi->size.width;
+    return vi->regions + xofs + yofs * vi->size.width;
 }
 
 static point *coor2point(const coordinate * c, point * p)
 {
-  assert(c && p);
-  p->x = c->x * TWIDTH + c->y * TWIDTH / 2;
-  p->y = c->y * THEIGHT;
-  return p;
+    assert(c && p);
+    p->x = c->x * TWIDTH + c->y * TWIDTH / 2;
+    p->y = c->y * THEIGHT;
+    return p;
 }
 
 static window *wnd_first, *wnd_last;
 
 static window *win_create(WINDOW * hwin)
 {
-  window *wnd = calloc(1, sizeof(window));
-  wnd->handle = hwin;
-  if (wnd_first != NULL) {
-    wnd->next = wnd_first;
-    wnd_first->prev = wnd;
-    wnd_first = wnd;
-  } else {
-    wnd_first = wnd;
-    wnd_last = wnd;
-  }
-  return wnd;
+    window *wnd = calloc(1, sizeof(window));
+    wnd->handle = hwin;
+    if (wnd_first != NULL) {
+        wnd->next = wnd_first;
+        wnd_first->prev = wnd;
+        wnd_first = wnd;
+    }
+    else {
+        wnd_first = wnd;
+        wnd_last = wnd;
+    }
+    return wnd;
 }
 
 static void untag_region(selection * s, int nx, int ny)
 {
-  unsigned int key = ((nx << 12) ^ ny);
-  tag **tp = &s->tags[key & (MAXTHASH - 1)];
-  tag *t = NULL;
-  while (*tp) {
-    t = *tp;
-    if (t->coord.x == nx && t->coord.y == ny)
-      break;
-    tp = &t->nexthash;
-  }
-  if (!*tp)
+    unsigned int key = ((nx << 12) ^ ny);
+    tag **tp = &s->tags[key & (MAXTHASH - 1)];
+    tag *t = NULL;
+    while (*tp) {
+        t = *tp;
+        if (t->coord.x == nx && t->coord.y == ny)
+            break;
+        tp = &t->nexthash;
+    }
+    if (!*tp)
+        return;
+    *tp = t->nexthash;
+    free(t);
     return;
-  *tp = t->nexthash;
-  free(t);
-  return;
 }
 
 static void tag_region(selection * s, int nx, int ny)
 {
-  unsigned int key = ((nx << 12) ^ ny);
-  tag **tp = &s->tags[key & (MAXTHASH - 1)];
-  while (*tp) {
-    tag *t = *tp;
-    if (t->coord.x == nx && t->coord.y == ny)
-      return;
-    tp = &t->nexthash;
-  }
-  *tp = calloc(1, sizeof(tag));
-  (*tp)->coord.x = nx;
-  (*tp)->coord.y = ny;
-  (*tp)->coord.pl = findplane(nx, ny);
-  return;
+    unsigned int key = ((nx << 12) ^ ny);
+    tag **tp = &s->tags[key & (MAXTHASH - 1)];
+    while (*tp) {
+        tag *t = *tp;
+        if (t->coord.x == nx && t->coord.y == ny)
+            return;
+        tp = &t->nexthash;
+    }
+    *tp = calloc(1, sizeof(tag));
+    (*tp)->coord.x = nx;
+    (*tp)->coord.y = ny;
+    (*tp)->coord.pl = findplane(nx, ny);
+    return;
 }
 
 static int tagged_region(selection * s, int nx, int ny)
 {
-  unsigned int key = ((nx << 12) ^ ny);
-  tag **tp = &s->tags[key & (MAXTHASH - 1)];
-  while (*tp) {
-    tag *t = *tp;
-    if (t->coord.x == nx && t->coord.y == ny)
-      return 1;
-    tp = &t->nexthash;
-  }
-  return 0;
+    unsigned int key = ((nx << 12) ^ ny);
+    tag **tp = &s->tags[key & (MAXTHASH - 1)];
+    while (*tp) {
+        tag *t = *tp;
+        if (t->coord.x == nx && t->coord.y == ny)
+            return 1;
+        tp = &t->nexthash;
+    }
+    return 0;
 }
 
 static chtype mr_tile(const map_region * mr, int highlight)
 {
-  int hl = 8 * highlight;
-  if (mr != NULL && mr->r != NULL) {
-    const region *r = mr->r;
-    switch (r->terrain->_name[0]) {
-      case 'o':
-        return '.' | COLOR_PAIR(hl + COLOR_CYAN) | A_BOLD;
-      case 'd':
-        return 'D' | COLOR_PAIR(hl + COLOR_YELLOW) | A_BOLD;
-      case 't':
-        return '%' | COLOR_PAIR(hl + COLOR_YELLOW) | A_BOLD;
-      case 'f':
-        if (r->terrain->_name[1] == 'o') {      /* fog */
-          return '.' | COLOR_PAIR(hl + COLOR_YELLOW) | A_NORMAL;
-        } else if (r->terrain->_name[1] == 'i') {       /* firewall */
-          return '%' | COLOR_PAIR(hl + COLOR_RED) | A_BOLD;
+    int hl = 8 * highlight;
+    if (mr != NULL && mr->r != NULL) {
+        const region *r = mr->r;
+        switch (r->terrain->_name[0]) {
+        case 'o':
+            return '.' | COLOR_PAIR(hl + COLOR_CYAN) | A_BOLD;
+        case 'd':
+            return 'D' | COLOR_PAIR(hl + COLOR_YELLOW) | A_BOLD;
+        case 't':
+            return '%' | COLOR_PAIR(hl + COLOR_YELLOW) | A_BOLD;
+        case 'f':
+            if (r->terrain->_name[1] == 'o') {      /* fog */
+                return '.' | COLOR_PAIR(hl + COLOR_YELLOW) | A_NORMAL;
+            }
+            else if (r->terrain->_name[1] == 'i') {       /* firewall */
+                return '%' | COLOR_PAIR(hl + COLOR_RED) | A_BOLD;
+            }
+            break;
+        case 'h':
+            return 'H' | COLOR_PAIR(hl + COLOR_YELLOW) | A_NORMAL;
+        case 'm':
+            return '^' | COLOR_PAIR(hl + COLOR_WHITE) | A_NORMAL;
+        case 'p':
+            if (r->terrain->_name[1] == 'l') {      /* plain */
+                if (r_isforest(r))
+                    return '#' | COLOR_PAIR(hl + COLOR_GREEN) | A_NORMAL;
+                return '+' | COLOR_PAIR(hl + COLOR_GREEN) | A_BOLD;
+            }
+            else if (r->terrain->_name[1] == 'a') {       /* packice */
+                return ':' | COLOR_PAIR(hl + COLOR_WHITE) | A_BOLD;
+            }
+            break;
+        case 'g':
+            return '*' | COLOR_PAIR(hl + COLOR_WHITE) | A_BOLD;
+        case 's':
+            return 'S' | COLOR_PAIR(hl + COLOR_MAGENTA) | A_NORMAL;
         }
-        break;
-      case 'h':
-        return 'H' | COLOR_PAIR(hl + COLOR_YELLOW) | A_NORMAL;
-      case 'm':
-        return '^' | COLOR_PAIR(hl + COLOR_WHITE) | A_NORMAL;
-      case 'p':
-        if (r->terrain->_name[1] == 'l') {      /* plain */
-          if (r_isforest(r))
-            return '#' | COLOR_PAIR(hl + COLOR_GREEN) | A_NORMAL;
-          return '+' | COLOR_PAIR(hl + COLOR_GREEN) | A_BOLD;
-        } else if (r->terrain->_name[1] == 'a') {       /* packice */
-          return ':' | COLOR_PAIR(hl + COLOR_WHITE) | A_BOLD;
-        }
-        break;
-      case 'g':
-        return '*' | COLOR_PAIR(hl + COLOR_WHITE) | A_BOLD;
-      case 's':
-        return 'S' | COLOR_PAIR(hl + COLOR_MAGENTA) | A_NORMAL;
+        return r->terrain->_name[0] | COLOR_PAIR(hl + COLOR_RED);
     }
-    return r->terrain->_name[0] | COLOR_PAIR(hl + COLOR_RED);
-  }
-  return ' ' | COLOR_PAIR(hl + COLOR_WHITE);
+    return ' ' | COLOR_PAIR(hl + COLOR_WHITE);
 }
 
 static void paint_map(window * wnd, const state * st)
 {
-  WINDOW *win = wnd->handle;
-  int lines = getmaxy(win);
-  int cols = getmaxx(win);
-  int vx, vy;
+    WINDOW *win = wnd->handle;
+    int lines = getmaxy(win);
+    int cols = getmaxx(win);
+    int vx, vy;
 
-  lines = lines / THEIGHT;
-  cols = cols / TWIDTH;
-  for (vy = 0; vy != lines; ++vy) {
-    int yp = (lines - vy - 1) * THEIGHT;
-    for (vx = 0; vx != cols; ++vx) {
-      map_region *mr = mr_get(&st->display, vx, vy);
-      int attr = 0;
-      int hl = 0;
-      int xp = vx * TWIDTH + (vy & 1) * TWIDTH / 2;
-      int nx, ny;
-      if (mr) {
-        if (st) {
-          cnormalize(&mr->coord, &nx, &ny);
-          if (tagged_region(st->selected, nx, ny)) {
-            attr |= A_REVERSE;
-          }
+    lines = lines / THEIGHT;
+    cols = cols / TWIDTH;
+    for (vy = 0; vy != lines; ++vy) {
+        int yp = (lines - vy - 1) * THEIGHT;
+        for (vx = 0; vx != cols; ++vx) {
+            map_region *mr = mr_get(&st->display, vx, vy);
+            int attr = 0;
+            int hl = 0;
+            int xp = vx * TWIDTH + (vy & 1) * TWIDTH / 2;
+            int nx, ny;
+            if (mr) {
+                if (st) {
+                    cnormalize(&mr->coord, &nx, &ny);
+                    if (tagged_region(st->selected, nx, ny)) {
+                        attr |= A_REVERSE;
+                    }
+                }
+                if (mr->r && (mr->r->flags & RF_MAPPER_HIGHLIGHT))
+                    hl = 1;
+                mvwaddch(win, yp, xp, mr_tile(mr, hl) | attr);
+            }
         }
-        if (mr->r && (mr->r->flags & RF_MAPPER_HIGHLIGHT))
-          hl = 1;
-        mvwaddch(win, yp, xp, mr_tile(mr, hl) | attr);
-      }
     }
-  }
 }
 
 map_region *cursor_region(const view * v, const coordinate * c)
 {
-  coordinate relpos;
-  int cx, cy;
+    coordinate relpos;
+    int cx, cy;
 
-  if (c) {
-    relpos.x = c->x - v->topleft.x;
-    relpos.y = c->y - v->topleft.y;
-    cy = relpos.y;
-    cx = relpos.x + cy / 2;
-    return mr_get(v, cx, cy);
-  }
-  return NULL;
+    if (c) {
+        relpos.x = c->x - v->topleft.x;
+        relpos.y = c->y - v->topleft.y;
+        cy = relpos.y;
+        cx = relpos.x + cy / 2;
+        return mr_get(v, cx, cy);
+    }
+    return NULL;
 }
 
 static void
 draw_cursor(WINDOW * win, selection * s, const view * v, const coordinate * c,
-  int show)
+int show)
 {
-  int lines = getmaxy(win) / THEIGHT;
-  int xp, yp, nx, ny;
-  int attr = 0;
-  map_region *mr = cursor_region(v, c);
-  coordinate relpos;
-  int cx, cy;
+    int lines = getmaxy(win) / THEIGHT;
+    int xp, yp, nx, ny;
+    int attr = 0;
+    map_region *mr = cursor_region(v, c);
+    coordinate relpos;
+    int cx, cy;
 
-  if (!mr)
-    return;
+    if (!mr)
+        return;
 
-  relpos.x = c->x - v->topleft.x;
-  relpos.y = c->y - v->topleft.y;
-  cy = relpos.y;
-  cx = relpos.x + cy / 2;
+    relpos.x = c->x - v->topleft.x;
+    relpos.y = c->y - v->topleft.y;
+    cy = relpos.y;
+    cx = relpos.x + cy / 2;
 
-  yp = (lines - cy - 1) * THEIGHT;
-  xp = cx * TWIDTH + (cy & 1) * TWIDTH / 2;
-  cnormalize(&mr->coord, &nx, &ny);
-  if (s && tagged_region(s, nx, ny))
-    attr = A_REVERSE;
-  if (mr->r) {
-    int hl = 0;
-    if (mr->r->flags & RF_MAPPER_HIGHLIGHT)
-      hl = 1;
-    mvwaddch(win, yp, xp, mr_tile(mr, hl) | attr);
-  } else
-    mvwaddch(win, yp, xp, ' ' | attr | COLOR_PAIR(COLOR_YELLOW));
-  if (show) {
-    attr = A_BOLD;
-    mvwaddch(win, yp, xp - 1, '<' | attr | COLOR_PAIR(COLOR_YELLOW));
-    mvwaddch(win, yp, xp + 1, '>' | attr | COLOR_PAIR(COLOR_YELLOW));
-  } else {
-    attr = A_NORMAL;
-    mvwaddch(win, yp, xp - 1, ' ' | attr | COLOR_PAIR(COLOR_WHITE));
-    mvwaddch(win, yp, xp + 1, ' ' | attr | COLOR_PAIR(COLOR_WHITE));
-  }
-  wmove(win, yp, xp);
-  wnoutrefresh(win);
+    yp = (lines - cy - 1) * THEIGHT;
+    xp = cx * TWIDTH + (cy & 1) * TWIDTH / 2;
+    cnormalize(&mr->coord, &nx, &ny);
+    if (s && tagged_region(s, nx, ny))
+        attr = A_REVERSE;
+    if (mr->r) {
+        int hl = 0;
+        if (mr->r->flags & RF_MAPPER_HIGHLIGHT)
+            hl = 1;
+        mvwaddch(win, yp, xp, mr_tile(mr, hl) | attr);
+    }
+    else
+        mvwaddch(win, yp, xp, ' ' | attr | COLOR_PAIR(COLOR_YELLOW));
+    if (show) {
+        attr = A_BOLD;
+        mvwaddch(win, yp, xp - 1, '<' | attr | COLOR_PAIR(COLOR_YELLOW));
+        mvwaddch(win, yp, xp + 1, '>' | attr | COLOR_PAIR(COLOR_YELLOW));
+    }
+    else {
+        attr = A_NORMAL;
+        mvwaddch(win, yp, xp - 1, ' ' | attr | COLOR_PAIR(COLOR_WHITE));
+        mvwaddch(win, yp, xp + 1, ' ' | attr | COLOR_PAIR(COLOR_WHITE));
+    }
+    wmove(win, yp, xp);
+    wnoutrefresh(win);
 }
 
 static void paint_status(window * wnd, const state * st)
 {
-  WINDOW *win = wnd->handle;
-  const char *name = "";
-  int nx, ny, uid = 0;
-  const char *terrain = "----";
-  map_region *mr = cursor_region(&st->display, &st->cursor);
-  if (mr && mr->r) {
-    uid = mr->r->uid;
-    if (mr->r->land) {
-      name = (const char *)mr->r->land->name;
-    } else {
-      name = mr->r->terrain->_name;
+    WINDOW *win = wnd->handle;
+    const char *name = "";
+    int nx, ny, uid = 0;
+    const char *terrain = "----";
+    map_region *mr = cursor_region(&st->display, &st->cursor);
+    if (mr && mr->r) {
+        uid = mr->r->uid;
+        if (mr->r->land) {
+            name = (const char *)mr->r->land->name;
+        }
+        else {
+            name = mr->r->terrain->_name;
+        }
+        terrain = mr->r->terrain->_name;
     }
-    terrain = mr->r->terrain->_name;
-  }
-  cnormalize(&st->cursor, &nx, &ny);
-  mvwprintw(win, 0, 0, "%4d %4d | %.4s | %.20s (%d)", nx, ny, terrain, name,
-    uid);
-  wclrtoeol(win);
+    cnormalize(&st->cursor, &nx, &ny);
+    mvwprintw(win, 0, 0, "%4d %4d | %.4s | %.20s (%d)", nx, ny, terrain, name,
+        uid);
+    wclrtoeol(win);
 }
 
 static bool handle_info_region(window * wnd, state * st, int c)
 {
-  return false;
+    return false;
 }
 
 static void paint_info_region(window * wnd, const state * st)
 {
-  WINDOW *win = wnd->handle;
-  int size = getmaxx(win) - 2;
-  int line = 0, maxline = getmaxy(win) - 2;
-  map_region *mr = cursor_region(&st->display, &st->cursor);
+    WINDOW *win = wnd->handle;
+    int size = getmaxx(win) - 2;
+    int line = 0, maxline = getmaxy(win) - 2;
+    map_region *mr = cursor_region(&st->display, &st->cursor);
 
-  unused_arg(st);
-  werase(win);
-  wxborder(win);
-  if (mr && mr->r) {
-    const region *r = mr->r;
-    if (r->land) {
-      mvwaddnstr(win, line++, 1, (char *)r->land->name, size);
-    } else {
-      mvwaddnstr(win, line++, 1, r->terrain->_name, size);
-    }
-    line++;
-    mvwprintw(win, line++, 1, "%s, age %d", r->terrain->_name, r->age);
-    if (r->land) {
-      mvwprintw(win, line++, 1, "$:%6d  P:%5d", r->land->money,
-        r->land->peasants);
-      mvwprintw(win, line++, 1, "H:%6d  %s:%5d", r->land->horses,
-        (r->flags & RF_MALLORN) ? "M" : "T",
-        r->land->trees[1] + r->land->trees[2]);
-    }
-    line++;
-    if (r->ships && (st->info_flags & IFL_SHIPS)) {
-      ship *sh;
-      wattron(win, A_BOLD | COLOR_PAIR(COLOR_YELLOW));
-      mvwaddnstr(win, line++, 1, "* ships:", size - 5);
-      wattroff(win, A_BOLD | COLOR_PAIR(COLOR_YELLOW));
-      for (sh = r->ships; sh && line < maxline; sh = sh->next) {
-        mvwprintw(win, line, 1, "%.4s ", itoa36(sh->no));
-        mvwaddnstr(win, line++, 6, (char *)sh->type->_name, size - 5);
-      }
-    }
-    if (r->units && (st->info_flags & IFL_FACTIONS)) {
-      unit *u;
-      wattron(win, A_BOLD | COLOR_PAIR(COLOR_YELLOW));
-      mvwaddnstr(win, line++, 1, "* factions:", size - 5);
-      wattroff(win, A_BOLD | COLOR_PAIR(COLOR_YELLOW));
-      for (u = r->units; u && line < maxline; u = u->next) {
-        if (!fval(u->faction, FFL_MARK)) {
-          mvwprintw(win, line, 1, "%.4s ", itoa36(u->faction->no));
-          mvwaddnstr(win, line++, 6, (char *)u->faction->name, size - 5);
-          fset(u->faction, FFL_MARK);
+    unused_arg(st);
+    werase(win);
+    wxborder(win);
+    if (mr && mr->r) {
+        const region *r = mr->r;
+        if (r->land) {
+            mvwaddnstr(win, line++, 1, (char *)r->land->name, size);
+        }
+        else {
+            mvwaddnstr(win, line++, 1, r->terrain->_name, size);
+        }
+        line++;
+        mvwprintw(win, line++, 1, "%s, age %d", r->terrain->_name, r->age);
+        if (r->land) {
+            mvwprintw(win, line++, 1, "$:%6d  P:%5d", r->land->money,
+                r->land->peasants);
+            mvwprintw(win, line++, 1, "H:%6d  %s:%5d", r->land->horses,
+                (r->flags & RF_MALLORN) ? "M" : "T",
+                r->land->trees[1] + r->land->trees[2]);
+        }
+        line++;
+        if (r->ships && (st->info_flags & IFL_SHIPS)) {
+            ship *sh;
+            wattron(win, A_BOLD | COLOR_PAIR(COLOR_YELLOW));
+            mvwaddnstr(win, line++, 1, "* ships:", size - 5);
+            wattroff(win, A_BOLD | COLOR_PAIR(COLOR_YELLOW));
+            for (sh = r->ships; sh && line < maxline; sh = sh->next) {
+                mvwprintw(win, line, 1, "%.4s ", itoa36(sh->no));
+                mvwaddnstr(win, line++, 6, (char *)sh->type->_name, size - 5);
+            }
+        }
+        if (r->units && (st->info_flags & IFL_FACTIONS)) {
+            unit *u;
+            wattron(win, A_BOLD | COLOR_PAIR(COLOR_YELLOW));
+            mvwaddnstr(win, line++, 1, "* factions:", size - 5);
+            wattroff(win, A_BOLD | COLOR_PAIR(COLOR_YELLOW));
+            for (u = r->units; u && line < maxline; u = u->next) {
+                if (!fval(u->faction, FFL_MARK)) {
+                    mvwprintw(win, line, 1, "%.4s ", itoa36(u->faction->no));
+                    mvwaddnstr(win, line++, 6, (char *)u->faction->name, size - 5);
+                    fset(u->faction, FFL_MARK);
+                }
+            }
+            for (u = r->units; u && line < maxline; u = u->next) {
+                freset(u->faction, FFL_MARK);
+            }
+        }
+        if (r->units && (st->info_flags & IFL_UNITS)) {
+            unit *u;
+            wattron(win, A_BOLD | COLOR_PAIR(COLOR_YELLOW));
+            mvwaddnstr(win, line++, 1, "* units:", size - 5);
+            wattroff(win, A_BOLD | COLOR_PAIR(COLOR_YELLOW));
+            for (u = r->units; u && line < maxline; u = u->next) {
+                mvwprintw(win, line, 1, "%.4s ", itoa36(u->no));
+                mvwaddnstr(win, line++, 6, (char *)u->name, size - 5);
+            }
         }
-      }
-      for (u = r->units; u && line < maxline; u = u->next) {
-        freset(u->faction, FFL_MARK);
-      }
     }
-    if (r->units && (st->info_flags & IFL_UNITS)) {
-      unit *u;
-      wattron(win, A_BOLD | COLOR_PAIR(COLOR_YELLOW));
-      mvwaddnstr(win, line++, 1, "* units:", size - 5);
-      wattroff(win, A_BOLD | COLOR_PAIR(COLOR_YELLOW));
-      for (u = r->units; u && line < maxline; u = u->next) {
-        mvwprintw(win, line, 1, "%.4s ", itoa36(u->no));
-        mvwaddnstr(win, line++, 6, (char *)u->name, size - 5);
-      }
-    }
-  }
 }
 
-static void (*paint_info) (struct window * wnd, const struct state * st);
+static void(*paint_info) (struct window * wnd, const struct state * st);
 
 static void paint_info_default(window * wnd, const state * st)
 {
-  if (paint_info)
-    paint_info(wnd, st);
-  else
-    paint_info_region(wnd, st);
+    if (paint_info)
+        paint_info(wnd, st);
+    else
+        paint_info_region(wnd, st);
 }
 
-void set_info_function(void (*callback) (struct window *, const struct state *))
+void set_info_function(void(*callback) (struct window *, const struct state *))
 {
-  paint_info = callback;
+    paint_info = callback;
 }
 
 static char *askstring(WINDOW * win, const char *q, char *buffer, size_t size)
 {
-  werase(win);
-  mvwaddstr(win, 0, 0, (char *)q);
-  wmove(win, 0, (int)(strlen(q) + 1));
-  echo();
-  wgetnstr(win, buffer, (int)size);
-  noecho();
-  return buffer;
+    werase(win);
+    mvwaddstr(win, 0, 0, (char *)q);
+    wmove(win, 0, (int)(strlen(q) + 1));
+    echo();
+    wgetnstr(win, buffer, (int)size);
+    noecho();
+    return buffer;
 }
 
 static void statusline(WINDOW * win, const char *str)
 {
-  mvwaddstr(win, 0, 0, (char *)str);
-  wclrtoeol(win);
-  wnoutrefresh(win);
+    mvwaddstr(win, 0, 0, (char *)str);
+    wclrtoeol(win);
+    wnoutrefresh(win);
 }
 
 static void terraform_at(coordinate * c, const terrain_type * terrain)
 {
-  if (terrain != NULL) {
-    region *r;
-    int nx = c->x, ny = c->y;
-    pnormalize(&nx, &ny, c->pl);
-    r = findregion(nx, ny);
-    if (r == NULL) {
-      r = new_region(nx, ny, c->pl, 0);
+    if (terrain != NULL) {
+        region *r;
+        int nx = c->x, ny = c->y;
+        pnormalize(&nx, &ny, c->pl);
+        r = findregion(nx, ny);
+        if (r == NULL) {
+            r = new_region(nx, ny, c->pl, 0);
+        }
+        terraform_region(r, terrain);
     }
-    terraform_region(r, terrain);
-  }
 }
 
 static void
 terraform_selection(selection * selected, const terrain_type * terrain)
 {
-  int i;
+    int i;
 
-  if (terrain == NULL)
-    return;
-  for (i = 0; i != MAXTHASH; ++i) {
-    tag **tp = &selected->tags[i];
-    while (*tp) {
-      region *r;
-      tag *t = *tp;
-      int nx = t->coord.x, ny = t->coord.y;
-      plane *pl = t->coord.pl;
+    if (terrain == NULL)
+        return;
+    for (i = 0; i != MAXTHASH; ++i) {
+        tag **tp = &selected->tags[i];
+        while (*tp) {
+            region *r;
+            tag *t = *tp;
+            int nx = t->coord.x, ny = t->coord.y;
+            plane *pl = t->coord.pl;
 
-      pnormalize(&nx, &ny, pl);
-      r = findregion(nx, ny);
-      if (r == NULL) {
-        r = new_region(nx, ny, pl, 0);
-      }
-      terraform_region(r, terrain);
-      tp = &t->nexthash;
+            pnormalize(&nx, &ny, pl);
+            r = findregion(nx, ny);
+            if (r == NULL) {
+                r = new_region(nx, ny, pl, 0);
+            }
+            terraform_region(r, terrain);
+            tp = &t->nexthash;
+        }
     }
-  }
 }
 
 static faction *select_faction(state * st)
 {
-  list_selection *ilist = NULL, **iinsert;
-  list_selection *selected = NULL;
-  faction *f = factions;
+    list_selection *ilist = NULL, **iinsert;
+    list_selection *selected = NULL;
+    faction *f = factions;
 
-  if (!f)
-    return NULL;
-  iinsert = &ilist;
+    if (!f)
+        return NULL;
+    iinsert = &ilist;
 
-  while (f) {
-    char buffer[32];
-    sprintf(buffer, "%.4s %.26s", itoa36(f->no), f->name);
-    insert_selection(iinsert, NULL, buffer, (void *)f);
-    f = f->next;
-  }
-  selected = do_selection(ilist, "Select Faction", NULL, NULL);
-  st->wnd_info->update |= 1;
-  st->wnd_map->update |= 1;
-  st->wnd_status->update |= 1;
+    while (f) {
+        char buffer[32];
+        sprintf(buffer, "%.4s %.26s", itoa36(f->no), f->name);
+        insert_selection(iinsert, NULL, buffer, (void *)f);
+        f = f->next;
+    }
+    selected = do_selection(ilist, "Select Faction", NULL, NULL);
+    st->wnd_info->update |= 1;
+    st->wnd_map->update |= 1;
+    st->wnd_status->update |= 1;
 
-  if (selected == NULL)
-    return NULL;
-  return (faction *) selected->data;
+    if (selected == NULL)
+        return NULL;
+    return (faction *)selected->data;
 }
 
 static const terrain_type *select_terrain(state * st,
-  const terrain_type * default_terrain)
+    const terrain_type * default_terrain)
 {
-  list_selection *ilist = NULL, **iinsert;
-  list_selection *selected = NULL;
-  const terrain_type *terrain = terrains();
+    list_selection *ilist = NULL, **iinsert;
+    list_selection *selected = NULL;
+    const terrain_type *terrain = terrains();
 
-  if (!terrain)
-    return NULL;
-  iinsert = &ilist;
+    if (!terrain)
+        return NULL;
+    iinsert = &ilist;
 
-  while (terrain) {
-    insert_selection(iinsert, NULL, terrain->_name, (void *)terrain);
-    terrain = terrain->next;
-  }
-  selected = do_selection(ilist, "Terrain", NULL, NULL);
-  st->wnd_info->update |= 1;
-  st->wnd_map->update |= 1;
-  st->wnd_status->update |= 1;
+    while (terrain) {
+        insert_selection(iinsert, NULL, terrain->_name, (void *)terrain);
+        terrain = terrain->next;
+    }
+    selected = do_selection(ilist, "Terrain", NULL, NULL);
+    st->wnd_info->update |= 1;
+    st->wnd_map->update |= 1;
+    st->wnd_status->update |= 1;
 
-  if (selected == NULL)
-    return NULL;
-  return (const terrain_type *)selected->data;
+    if (selected == NULL)
+        return NULL;
+    return (const terrain_type *)selected->data;
 }
 
 static coordinate *region2coord(const region * r, coordinate * c)
 {
-  c->x = r->x;
-  c->y = r->y;
-  c->pl = rplane(r);
-  return c;
+    c->x = r->x;
+    c->y = r->y;
+    c->pl = rplane(r);
+    return c;
 }
 
 #ifdef __PDCURSES__
@@ -568,749 +575,779 @@ static coordinate *region2coord(const region * r, coordinate * c)
 
 void highlight_region(region * r, int toggle)
 {
-  if (r != NULL) {
-    if (toggle)
-      r->flags |= RF_MAPPER_HIGHLIGHT;
-    else
-      r->flags &= ~RF_MAPPER_HIGHLIGHT;
-  }
+    if (r != NULL) {
+        if (toggle)
+            r->flags |= RF_MAPPER_HIGHLIGHT;
+        else
+            r->flags &= ~RF_MAPPER_HIGHLIGHT;
+    }
 }
 
 void select_coordinate(struct selection *selected, int nx, int ny, int toggle)
 {
-  if (toggle)
-    tag_region(selected, nx, ny);
-  else
-    untag_region(selected, nx, ny);
+    if (toggle)
+        tag_region(selected, nx, ny);
+    else
+        untag_region(selected, nx, ny);
 }
 
 enum { MODE_MARK, MODE_SELECT, MODE_UNMARK, MODE_UNSELECT };
 
 static void select_regions(state * st, int selectmode)
 {
-  char sbuffer[80];
-  int findmode;
-  const char *statustext[] = {
-    "mark-", "select-", "unmark-", "deselect-"
-  };
-  const char *status = statustext[selectmode];
-  statusline(st->wnd_status->handle, status);
-  doupdate();
-  findmode = getch();
-  if (findmode == 'n') {        /* none */
-    int i;
-    sprintf(sbuffer, "%snone", status);
-    statusline(st->wnd_status->handle, sbuffer);
-    if (selectmode & MODE_SELECT) {
-      for (i = 0; i != MAXTHASH; ++i) {
-        tag **tp = &st->selected->tags[i];
-        while (*tp) {
-          tag *t = *tp;
-          *tp = t->nexthash;
-          free(t);
-        }
-      }
-    } else {
-      region *r;
-      for (r = regions; r; r = r->next) {
-        r->flags &= ~RF_MAPPER_HIGHLIGHT;
-      }
-    }
-  } else if (findmode == 'm') {
-    region *r;
-    sprintf(sbuffer, "%smonsters", status);
-    statusline(st->wnd_status->handle, sbuffer);
-    for (r = regions; r; r = r->next) {
-      unit *u = r->units;
-      for (; u; u = u->next) {
-        if (fval(u->faction, FFL_NPC) != 0)
-          break;
-      }
-      if (u) {
-        if (selectmode & MODE_SELECT) {
-          select_coordinate(st->selected, r->x, r->y,
-            selectmode == MODE_SELECT);
-        } else {
-          highlight_region(r, selectmode == MODE_MARK);
-        }
-      }
-    }
-  } else if (findmode == 'p') {
-    region *r;
-    sprintf(sbuffer, "%splayers", status);
-    statusline(st->wnd_status->handle, sbuffer);
-    for (r = regions; r; r = r->next) {
-      unit *u = r->units;
-      for (; u; u = u->next) {
-        if (fval(u->faction, FFL_NPC) == 0)
-          break;
-      }
-      if (u) {
-        if (selectmode & MODE_SELECT) {
-          select_coordinate(st->selected, r->x, r->y,
-            selectmode == MODE_SELECT);
-        } else {
-          highlight_region(r, selectmode == MODE_MARK);
-        }
-      }
-    }
-  } else if (findmode == 'u') {
-    region *r;
-    sprintf(sbuffer, "%sunits", status);
-    statusline(st->wnd_status->handle, sbuffer);
-    for (r = regions; r; r = r->next) {
-      if (r->units) {
-        if (selectmode & MODE_SELECT) {
-          select_coordinate(st->selected, r->x, r->y,
-            selectmode == MODE_SELECT);
-        } else {
-          highlight_region(r, selectmode == MODE_MARK);
-        }
-      }
-    }
-  } else if (findmode == 's') {
-    region *r;
-    sprintf(sbuffer, "%sships", status);
-    statusline(st->wnd_status->handle, sbuffer);
-    for (r = regions; r; r = r->next) {
-      if (r->ships) {
-        if (selectmode & MODE_SELECT) {
-          select_coordinate(st->selected, r->x, r->y,
-            selectmode == MODE_SELECT);
-        } else {
-          highlight_region(r, selectmode == MODE_MARK);
-        }
-      }
-    }
-  } else if (findmode == 'f') {
-    char fbuffer[12];
-    sprintf(sbuffer, "%sfaction:", status);
-    askstring(st->wnd_status->handle, sbuffer, fbuffer, 12);
-    if (fbuffer[0]) {
-      faction *f = findfaction(atoi36(fbuffer));
-
-      if (f != NULL) {
-        unit *u;
-
-        sprintf(sbuffer, "%sfaction: %s", status, itoa36(f->no));
+    char sbuffer[80];
+    int findmode;
+    const char *statustext[] = {
+        "mark-", "select-", "unmark-", "deselect-"
+    };
+    const char *status = statustext[selectmode];
+    statusline(st->wnd_status->handle, status);
+    doupdate();
+    findmode = getch();
+    if (findmode == 'n') {        /* none */
+        int i;
+        sprintf(sbuffer, "%snone", status);
         statusline(st->wnd_status->handle, sbuffer);
-        for (u = f->units; u; u = u->nextF) {
-          region *r = u->region;
-          if (selectmode & MODE_SELECT) {
-            select_coordinate(st->selected, r->x, r->y,
-              selectmode == MODE_SELECT);
-          } else {
-            highlight_region(r, selectmode == MODE_MARK);
-          }
+        if (selectmode & MODE_SELECT) {
+            for (i = 0; i != MAXTHASH; ++i) {
+                tag **tp = &st->selected->tags[i];
+                while (*tp) {
+                    tag *t = *tp;
+                    *tp = t->nexthash;
+                    free(t);
+                }
+            }
         }
-      } else {
-        statusline(st->wnd_status->handle, "faction not found.");
+        else {
+            region *r;
+            for (r = regions; r; r = r->next) {
+                r->flags &= ~RF_MAPPER_HIGHLIGHT;
+            }
+        }
+    }
+    else if (findmode == 'm') {
+        region *r;
+        sprintf(sbuffer, "%smonsters", status);
+        statusline(st->wnd_status->handle, sbuffer);
+        for (r = regions; r; r = r->next) {
+            unit *u = r->units;
+            for (; u; u = u->next) {
+                if (fval(u->faction, FFL_NPC) != 0)
+                    break;
+            }
+            if (u) {
+                if (selectmode & MODE_SELECT) {
+                    select_coordinate(st->selected, r->x, r->y,
+                        selectmode == MODE_SELECT);
+                }
+                else {
+                    highlight_region(r, selectmode == MODE_MARK);
+                }
+            }
+        }
+    }
+    else if (findmode == 'p') {
+        region *r;
+        sprintf(sbuffer, "%splayers", status);
+        statusline(st->wnd_status->handle, sbuffer);
+        for (r = regions; r; r = r->next) {
+            unit *u = r->units;
+            for (; u; u = u->next) {
+                if (fval(u->faction, FFL_NPC) == 0)
+                    break;
+            }
+            if (u) {
+                if (selectmode & MODE_SELECT) {
+                    select_coordinate(st->selected, r->x, r->y,
+                        selectmode == MODE_SELECT);
+                }
+                else {
+                    highlight_region(r, selectmode == MODE_MARK);
+                }
+            }
+        }
+    }
+    else if (findmode == 'u') {
+        region *r;
+        sprintf(sbuffer, "%sunits", status);
+        statusline(st->wnd_status->handle, sbuffer);
+        for (r = regions; r; r = r->next) {
+            if (r->units) {
+                if (selectmode & MODE_SELECT) {
+                    select_coordinate(st->selected, r->x, r->y,
+                        selectmode == MODE_SELECT);
+                }
+                else {
+                    highlight_region(r, selectmode == MODE_MARK);
+                }
+            }
+        }
+    }
+    else if (findmode == 's') {
+        region *r;
+        sprintf(sbuffer, "%sships", status);
+        statusline(st->wnd_status->handle, sbuffer);
+        for (r = regions; r; r = r->next) {
+            if (r->ships) {
+                if (selectmode & MODE_SELECT) {
+                    select_coordinate(st->selected, r->x, r->y,
+                        selectmode == MODE_SELECT);
+                }
+                else {
+                    highlight_region(r, selectmode == MODE_MARK);
+                }
+            }
+        }
+    }
+    else if (findmode == 'f') {
+        char fbuffer[12];
+        sprintf(sbuffer, "%sfaction:", status);
+        askstring(st->wnd_status->handle, sbuffer, fbuffer, 12);
+        if (fbuffer[0]) {
+            faction *f = findfaction(atoi36(fbuffer));
+
+            if (f != NULL) {
+                unit *u;
+
+                sprintf(sbuffer, "%sfaction: %s", status, itoa36(f->no));
+                statusline(st->wnd_status->handle, sbuffer);
+                for (u = f->units; u; u = u->nextF) {
+                    region *r = u->region;
+                    if (selectmode & MODE_SELECT) {
+                        select_coordinate(st->selected, r->x, r->y,
+                            selectmode == MODE_SELECT);
+                    }
+                    else {
+                        highlight_region(r, selectmode == MODE_MARK);
+                    }
+                }
+            }
+            else {
+                statusline(st->wnd_status->handle, "faction not found.");
+                beep();
+                return;
+            }
+        }
+    }
+    else if (findmode == 't') {
+        const struct terrain_type *terrain;
+        sprintf(sbuffer, "%sterrain: ", status);
+        statusline(st->wnd_status->handle, sbuffer);
+        terrain = select_terrain(st, NULL);
+        if (terrain != NULL) {
+            region *r;
+            sprintf(sbuffer, "%sterrain: %s", status, terrain->_name);
+            statusline(st->wnd_status->handle, sbuffer);
+            for (r = regions; r; r = r->next) {
+                if (r->terrain == terrain) {
+                    if (selectmode & MODE_SELECT) {
+                        select_coordinate(st->selected, r->x, r->y,
+                            selectmode == MODE_SELECT);
+                    }
+                    else {
+                        highlight_region(r, selectmode == MODE_MARK);
+                    }
+                }
+            }
+        }
+    }
+    else {
+        statusline(st->wnd_status->handle, "unknown command.");
         beep();
         return;
-      }
     }
-  } else if (findmode == 't') {
-    const struct terrain_type *terrain;
-    sprintf(sbuffer, "%sterrain: ", status);
-    statusline(st->wnd_status->handle, sbuffer);
-    terrain = select_terrain(st, NULL);
-    if (terrain != NULL) {
-      region *r;
-      sprintf(sbuffer, "%sterrain: %s", status, terrain->_name);
-      statusline(st->wnd_status->handle, sbuffer);
-      for (r = regions; r; r = r->next) {
-        if (r->terrain == terrain) {
-          if (selectmode & MODE_SELECT) {
-            select_coordinate(st->selected, r->x, r->y,
-              selectmode == MODE_SELECT);
-          } else {
-            highlight_region(r, selectmode == MODE_MARK);
-          }
-        }
-      }
-    }
-  } else {
-    statusline(st->wnd_status->handle, "unknown command.");
-    beep();
-    return;
-  }
-  st->wnd_info->update |= 3;
-  st->wnd_status->update |= 3;
-  st->wnd_map->update |= 3;
+    st->wnd_info->update |= 3;
+    st->wnd_status->update |= 3;
+    st->wnd_map->update |= 3;
 }
 
 static void handlekey(state * st, int c)
 {
-  window *wnd;
-  coordinate *cursor = &st->cursor;
-  static char locate[80];
-  static int findmode = 0;
-  region *r;
-  char sbuffer[80];
-  static char kbuffer[80];
-  int n, nx, ny;
+    window *wnd;
+    coordinate *cursor = &st->cursor;
+    static char locate[80];
+    static int findmode = 0;
+    region *r;
+    char sbuffer[80];
+    static char kbuffer[80];
+    int n, nx, ny;
 
-  switch (c) {
+    switch (c) {
     case FAST_RIGHT:
-      cursor->x += 10;
-      st->wnd_info->update |= 1;
-      st->wnd_status->update |= 1;
-      break;
+        cursor->x += 10;
+        st->wnd_info->update |= 1;
+        st->wnd_status->update |= 1;
+        break;
     case FAST_LEFT:
-      cursor->x -= 10;
-      st->wnd_info->update |= 1;
-      st->wnd_status->update |= 1;
-      break;
+        cursor->x -= 10;
+        st->wnd_info->update |= 1;
+        st->wnd_status->update |= 1;
+        break;
     case FAST_UP:
-      cursor->y += 10;
-      st->wnd_info->update |= 1;
-      st->wnd_status->update |= 1;
-      break;
+        cursor->y += 10;
+        st->wnd_info->update |= 1;
+        st->wnd_status->update |= 1;
+        break;
     case FAST_DOWN:
-      cursor->y -= 10;
-      st->wnd_info->update |= 1;
-      st->wnd_status->update |= 1;
-      break;
+        cursor->y -= 10;
+        st->wnd_info->update |= 1;
+        st->wnd_status->update |= 1;
+        break;
     case KEY_UP:
-      cursor->y++;
-      st->wnd_info->update |= 1;
-      st->wnd_status->update |= 1;
-      break;
+        cursor->y++;
+        st->wnd_info->update |= 1;
+        st->wnd_status->update |= 1;
+        break;
     case KEY_DOWN:
-      cursor->y--;
-      st->wnd_info->update |= 1;
-      st->wnd_status->update |= 1;
-      break;
+        cursor->y--;
+        st->wnd_info->update |= 1;
+        st->wnd_status->update |= 1;
+        break;
     case KEY_RIGHT:
-      cursor->x++;
-      st->wnd_info->update |= 1;
-      st->wnd_status->update |= 1;
-      break;
+        cursor->x++;
+        st->wnd_info->update |= 1;
+        st->wnd_status->update |= 1;
+        break;
     case KEY_LEFT:
-      cursor->x--;
-      st->wnd_info->update |= 1;
-      st->wnd_status->update |= 1;
-      break;
+        cursor->x--;
+        st->wnd_info->update |= 1;
+        st->wnd_status->update |= 1;
+        break;
     case 'S':
     case KEY_SAVE:
     case KEY_F(2):
-      /* if (st->modified) */  {
-      char datafile[MAX_PATH];
+        /* if (st->modified) */  {
+            char datafile[MAX_PATH];
 
-      askstring(st->wnd_status->handle, "save as:", datafile, sizeof(datafile));
-      if (strlen(datafile) > 0) {
-        create_backup(datafile);
-        remove_empty_units();
-        writegame(datafile);
-        st->modified = 0;
-      }
-    }
-      break;
-    case 'B':
-      /*
-         make_block(st->cursor.x, st->cursor.y, 6, select_terrain(st, NULL));
-       */
-      cnormalize(&st->cursor, &nx, &ny);
-      n = rng_int() % 8 + 8;
-      build_island_e3(nx, ny, n, n * 3);
-      st->modified = 1;
-      st->wnd_info->update |= 1;
-      st->wnd_status->update |= 1;
-      st->wnd_map->update |= 1;
-      break;
-    case 0x02:                 /* CTRL+b */
-      cnormalize(&st->cursor, &nx, &ny);
-      make_block(nx, ny, 6, newterrain(T_OCEAN));
-      st->modified = 1;
-      st->wnd_info->update |= 1;
-      st->wnd_status->update |= 1;
-      st->wnd_map->update |= 1;
-      break;
-    case 0x09:                 /* tab = next selected */
-      if (regions != NULL) {
-        map_region *mr = cursor_region(&st->display, cursor);
-        if (mr) {
-          region *first = mr->r;
-          region *cur = (first && first->next) ? first->next : regions;
-
-          while (cur != first) {
-            coordinate coord;
-            region2coord(cur, &coord);
-            cnormalize(&coord, &nx, &ny);
-            if (tagged_region(st->selected, nx, ny)) {
-              st->cursor = coord;
-              st->wnd_info->update |= 1;
-              st->wnd_status->update |= 1;
-              break;
+            askstring(st->wnd_status->handle, "save as:", datafile, sizeof(datafile));
+            if (strlen(datafile) > 0) {
+                create_backup(datafile);
+                remove_empty_units();
+                writegame(datafile);
+                st->modified = 0;
+            }
+    }
+        break;
+    case 'B':
+        /*
+           make_block(st->cursor.x, st->cursor.y, 6, select_terrain(st, NULL));
+           */
+        cnormalize(&st->cursor, &nx, &ny);
+        n = rng_int() % 8 + 8;
+        build_island_e3(nx, ny, n, n * 3);
+        st->modified = 1;
+        st->wnd_info->update |= 1;
+        st->wnd_status->update |= 1;
+        st->wnd_map->update |= 1;
+        break;
+    case 0x02:                 /* CTRL+b */
+        cnormalize(&st->cursor, &nx, &ny);
+        make_block(nx, ny, 6, newterrain(T_OCEAN));
+        st->modified = 1;
+        st->wnd_info->update |= 1;
+        st->wnd_status->update |= 1;
+        st->wnd_map->update |= 1;
+        break;
+    case 0x09:                 /* tab = next selected */
+        if (regions != NULL) {
+            map_region *mr = cursor_region(&st->display, cursor);
+            if (mr) {
+                region *first = mr->r;
+                region *cur = (first && first->next) ? first->next : regions;
+
+                while (cur != first) {
+                    coordinate coord;
+                    region2coord(cur, &coord);
+                    cnormalize(&coord, &nx, &ny);
+                    if (tagged_region(st->selected, nx, ny)) {
+                        st->cursor = coord;
+                        st->wnd_info->update |= 1;
+                        st->wnd_status->update |= 1;
+                        break;
+                    }
+                    cur = cur->next;
+                    if (!cur && first)
+                        cur = regions;
+                }
             }
-            cur = cur->next;
-            if (!cur && first)
-              cur = regions;
-          }
         }
-      }
-      break;
+        break;
 
     case 'p':
-      if (planes) {
-        plane *pl = planes;
-        if (cursor->pl) {
-          while (pl && pl != cursor->pl) {
-            pl = pl->next;
-          }
-          if (pl && pl->next) {
-            cursor->pl = pl->next;
-          } else {
-            cursor->pl = get_homeplane();
-          }
-        } else {
-          cursor->pl = planes;
+        if (planes) {
+            plane *pl = planes;
+            if (cursor->pl) {
+                while (pl && pl != cursor->pl) {
+                    pl = pl->next;
+                }
+                if (pl && pl->next) {
+                    cursor->pl = pl->next;
+                }
+                else {
+                    cursor->pl = get_homeplane();
+                }
+            }
+            else {
+                cursor->pl = planes;
+            }
         }
-      }
-      break;
+        break;
 
     case 'a':
-      if (regions != NULL) {
-        map_region *mr = cursor_region(&st->display, cursor);
-        if (mr && mr->r) {
-          region *cur = mr->r;
-          plane *pl = rplane(cur);
-          if (pl == NULL) {
-            cur = r_standard_to_astral(cur);
-          } else if (is_astral(cur)) {
-            cur = r_astral_to_standard(cur);
-          } else {
-            cur = NULL;
-          }
-          if (cur != NULL) {
-            region2coord(cur, &st->cursor);
-          } else {
-            beep();
-          }
+        if (regions != NULL) {
+            map_region *mr = cursor_region(&st->display, cursor);
+            if (mr && mr->r) {
+                region *cur = mr->r;
+                plane *pl = rplane(cur);
+                if (pl == NULL) {
+                    cur = r_standard_to_astral(cur);
+                }
+                else if (is_astral(cur)) {
+                    cur = r_astral_to_standard(cur);
+                }
+                else {
+                    cur = NULL;
+                }
+                if (cur != NULL) {
+                    region2coord(cur, &st->cursor);
+                }
+                else {
+                    beep();
+                }
+            }
         }
-      }
-      break;
+        break;
     case 'g':
-      askstring(st->wnd_status->handle, "goto-x:", sbuffer, 12);
-      if (sbuffer[0]) {
-        askstring(st->wnd_status->handle, "goto-y:", sbuffer + 16, 12);
-        if (sbuffer[16]) {
-          st->cursor.x = atoi(sbuffer);
-          st->cursor.y = atoi(sbuffer + 16);
-          st->wnd_info->update |= 1;
-          st->wnd_status->update |= 1;
+        askstring(st->wnd_status->handle, "goto-x:", sbuffer, 12);
+        if (sbuffer[0]) {
+            askstring(st->wnd_status->handle, "goto-y:", sbuffer + 16, 12);
+            if (sbuffer[16]) {
+                st->cursor.x = atoi(sbuffer);
+                st->cursor.y = atoi(sbuffer + 16);
+                st->wnd_info->update |= 1;
+                st->wnd_status->update |= 1;
+            }
         }
-      }
-      break;
+        break;
     case 0x14:                 /* C-t */
-      terraform_at(&st->cursor, select_terrain(st, NULL));
-      st->modified = 1;
-      st->wnd_info->update |= 1;
-      st->wnd_status->update |= 1;
-      st->wnd_map->update |= 1;
-      break;
+        terraform_at(&st->cursor, select_terrain(st, NULL));
+        st->modified = 1;
+        st->wnd_info->update |= 1;
+        st->wnd_status->update |= 1;
+        st->wnd_map->update |= 1;
+        break;
     case 'I':
-      statusline(st->wnd_status->handle, "info-");
-      doupdate();
-      do {
-        c = getch();
-        switch (c) {
-          case 's':
-            st->info_flags ^= IFL_SHIPS;
-            if (st->info_flags & IFL_SHIPS)
-              statusline(st->wnd_status->handle, "info-ships true");
-            else
-              statusline(st->wnd_status->handle, "info-ships false");
-            break;
-          case 'b':
-            st->info_flags ^= IFL_BUILDINGS;
-            if (st->info_flags & IFL_BUILDINGS)
-              statusline(st->wnd_status->handle, "info-buildings true");
-            else
-              statusline(st->wnd_status->handle, "info-buildings false");
-          case 'f':
-            st->info_flags ^= IFL_FACTIONS;
-            if (st->info_flags & IFL_FACTIONS)
-              statusline(st->wnd_status->handle, "info-factions true");
-            else
-              statusline(st->wnd_status->handle, "info-factions false");
-            break;
-          case 'u':
-            st->info_flags ^= IFL_UNITS;
-            if (st->info_flags & IFL_UNITS)
-              statusline(st->wnd_status->handle, "info-units true");
-            else
-              statusline(st->wnd_status->handle, "info-units false");
-            break;
-          case 27:             /* esc */
-            break;
-          default:
-            beep();
-            c = 0;
-        }
-      } while (c == 0);
-      break;
+        statusline(st->wnd_status->handle, "info-");
+        doupdate();
+        do {
+            c = getch();
+            switch (c) {
+            case 's':
+                st->info_flags ^= IFL_SHIPS;
+                if (st->info_flags & IFL_SHIPS)
+                    statusline(st->wnd_status->handle, "info-ships true");
+                else
+                    statusline(st->wnd_status->handle, "info-ships false");
+                break;
+            case 'b':
+                st->info_flags ^= IFL_BUILDINGS;
+                if (st->info_flags & IFL_BUILDINGS)
+                    statusline(st->wnd_status->handle, "info-buildings true");
+                else
+                    statusline(st->wnd_status->handle, "info-buildings false");
+            case 'f':
+                st->info_flags ^= IFL_FACTIONS;
+                if (st->info_flags & IFL_FACTIONS)
+                    statusline(st->wnd_status->handle, "info-factions true");
+                else
+                    statusline(st->wnd_status->handle, "info-factions false");
+                break;
+            case 'u':
+                st->info_flags ^= IFL_UNITS;
+                if (st->info_flags & IFL_UNITS)
+                    statusline(st->wnd_status->handle, "info-units true");
+                else
+                    statusline(st->wnd_status->handle, "info-units false");
+                break;
+            case 27:             /* esc */
+                break;
+            default:
+                beep();
+                c = 0;
+            }
+        } while (c == 0);
+        break;
     case 'L':
-      if (global.vm_state) {
-        move(0, 0);
-        refresh();
-        lua_do((struct lua_State *)global.vm_state);
-        /* todo: do this from inside the script */
+        if (global.vm_state) {
+            move(0, 0);
+            refresh();
+            lua_do((struct lua_State *)global.vm_state);
+            /* todo: do this from inside the script */
+            clear();
+            st->wnd_info->update |= 1;
+            st->wnd_status->update |= 1;
+            st->wnd_map->update |= 1;
+        }
+        break;
+    case 12:                   /* Ctrl-L */
         clear();
         st->wnd_info->update |= 1;
         st->wnd_status->update |= 1;
         st->wnd_map->update |= 1;
-      }
-      break;
-    case 12:                   /* Ctrl-L */
-      clear();
-      st->wnd_info->update |= 1;
-      st->wnd_status->update |= 1;
-      st->wnd_map->update |= 1;
-      break;
+        break;
     case 'h':
-      select_regions(st, MODE_MARK);
-      break;
+        select_regions(st, MODE_MARK);
+        break;
     case 'H':
-      select_regions(st, MODE_UNMARK);
-      break;
+        select_regions(st, MODE_UNMARK);
+        break;
     case 't':
-      select_regions(st, MODE_SELECT);
-      break;
+        select_regions(st, MODE_SELECT);
+        break;
     case 'T':
-      select_regions(st, MODE_UNSELECT);
-      break;
+        select_regions(st, MODE_UNSELECT);
+        break;
     case ';':
-      statusline(st->wnd_status->handle, "tag-");
-      doupdate();
-      switch (getch()) {
+        statusline(st->wnd_status->handle, "tag-");
+        doupdate();
+        switch (getch()) {
         case 't':
-          terraform_selection(st->selected, select_terrain(st, NULL));
-          st->modified = 1;
-          st->wnd_info->update |= 1;
-          st->wnd_status->update |= 1;
-          st->wnd_map->update |= 1;
-          break;
+            terraform_selection(st->selected, select_terrain(st, NULL));
+            st->modified = 1;
+            st->wnd_info->update |= 1;
+            st->wnd_status->update |= 1;
+            st->wnd_map->update |= 1;
+            break;
         case 'm':
-          break;
+            break;
         default:
-          statusline(st->wnd_status->handle, "unknown command.");
-          beep();
-      }
-      break;
+            statusline(st->wnd_status->handle, "unknown command.");
+            beep();
+        }
+        break;
     case ' ':
-      cnormalize(cursor, &nx, &ny);
-      if (tagged_region(st->selected, nx, ny))
-        untag_region(st->selected, nx, ny);
-      else
-        tag_region(st->selected, nx, ny);
-      break;
+        cnormalize(cursor, &nx, &ny);
+        if (tagged_region(st->selected, nx, ny))
+            untag_region(st->selected, nx, ny);
+        else
+            tag_region(st->selected, nx, ny);
+        break;
     case 'A':
-      sprintf(sbuffer, "%s/newfactions", basepath());
-      seed_players(sbuffer, false);
-      st->wnd_map->update |= 1;
-      break;
+        sprintf(sbuffer, "%s/newfactions", basepath());
+        seed_players(sbuffer, false);
+        st->wnd_map->update |= 1;
+        break;
     case '/':
-      statusline(st->wnd_status->handle, "find-");
-      doupdate();
-      findmode = getch();
-      if (findmode == 'r') {
-        askstring(st->wnd_status->handle, "find-region:", locate,
-          sizeof(locate));
-      } else if (findmode == 'u') {
-        askstring(st->wnd_status->handle, "find-unit:", locate, sizeof(locate));
-      } else if (findmode == 'f') {
-        askstring(st->wnd_status->handle, "find-faction:", locate,
-          sizeof(locate));
-      } else if (findmode == 'F') {
-        faction *f = select_faction(st);
-        if (f != NULL) {
-          strcpy(locate, itoa36(f->no));
-          findmode = 'f';
-        } else {
-          break;
+        statusline(st->wnd_status->handle, "find-");
+        doupdate();
+        findmode = getch();
+        if (findmode == 'r') {
+            askstring(st->wnd_status->handle, "find-region:", locate,
+                sizeof(locate));
         }
-      } else {
-        statusline(st->wnd_status->handle, "unknown command.");
-        beep();
-        break;
-      }
-      /* achtung: fall-through ist absicht: */
-      if (!strlen(locate))
-        break;
-    case 'n':
-      if (findmode == 'u') {
-        unit *u = findunit(atoi36(locate));
-        r = u ? u->region : NULL;
-      } else if (findmode && regions != NULL) {
-        struct faction *f = NULL;
-        map_region *mr = cursor_region(&st->display, cursor);
-        region *first = (mr && mr->r && mr->r->next) ? mr->r->next : regions;
-
-        if (findmode == 'f') {
-          sprintf(sbuffer, "find-faction: %s", locate);
-          statusline(st->wnd_status->handle, sbuffer);
-          f = findfaction(atoi36(locate));
-          if (f == NULL) {
-            statusline(st->wnd_status->handle, "faction not found.");
-            beep();
-            break;
-          }
+        else if (findmode == 'u') {
+            askstring(st->wnd_status->handle, "find-unit:", locate, sizeof(locate));
         }
-        for (r = first;;) {
-          if (findmode == 'r' && r->land && r->land->name
-            && strstr((const char *)r->land->name, locate)) {
-            break;
-          } else if (findmode == 'f') {
-            unit *u;
-            for (u = r->units; u; u = u->next) {
-              if (u->faction == f) {
-                break;
-              }
+        else if (findmode == 'f') {
+            askstring(st->wnd_status->handle, "find-faction:", locate,
+                sizeof(locate));
+        }
+        else if (findmode == 'F') {
+            faction *f = select_faction(st);
+            if (f != NULL) {
+                strcpy(locate, itoa36(f->no));
+                findmode = 'f';
             }
-            if (u)
-              break;
-          }
-          r = r->next;
-          if (r == NULL)
-            r = regions;
-          if (r == first) {
-            r = NULL;
-            statusline(st->wnd_status->handle, "not found.");
+            else {
+                break;
+            }
+        }
+        else {
+            statusline(st->wnd_status->handle, "unknown command.");
             beep();
             break;
-          }
         }
-      } else {
-        r = NULL;
-      }
-      if (r != NULL) {
-        region2coord(r, &st->cursor);
-        st->wnd_info->update |= 1;
-        st->wnd_status->update |= 1;
-      }
-      break;
-    case 'Q':
-      g_quit = 1;
-      break;
-    default:
-      for (wnd = wnd_first; wnd != NULL; wnd = wnd->next) {
-        if (wnd->handlekey) {
-          if (wnd->handlekey(wnd, st, c))
+        /* achtung: fall-through ist absicht: */
+        if (!strlen(locate))
             break;
+    case 'n':
+        if (findmode == 'u') {
+            unit *u = findunit(atoi36(locate));
+            r = u ? u->region : NULL;
         }
-      }
-      if (wnd == NULL) {
-        if (kbuffer[0] == 0) {
-          strcpy(kbuffer, "getch:");
+        else if (findmode && regions != NULL) {
+            struct faction *f = NULL;
+            map_region *mr = cursor_region(&st->display, cursor);
+            region *first = (mr && mr->r && mr->r->next) ? mr->r->next : regions;
+
+            if (findmode == 'f') {
+                sprintf(sbuffer, "find-faction: %s", locate);
+                statusline(st->wnd_status->handle, sbuffer);
+                f = findfaction(atoi36(locate));
+                if (f == NULL) {
+                    statusline(st->wnd_status->handle, "faction not found.");
+                    beep();
+                    break;
+                }
+            }
+            for (r = first;;) {
+                if (findmode == 'r' && r->land && r->land->name
+                    && strstr((const char *)r->land->name, locate)) {
+                    break;
+                }
+                else if (findmode == 'f') {
+                    unit *u;
+                    for (u = r->units; u; u = u->next) {
+                        if (u->faction == f) {
+                            break;
+                        }
+                    }
+                    if (u)
+                        break;
+                }
+                r = r->next;
+                if (r == NULL)
+                    r = regions;
+                if (r == first) {
+                    r = NULL;
+                    statusline(st->wnd_status->handle, "not found.");
+                    beep();
+                    break;
+                }
+            }
         }
-        sprintf(sbuffer, " 0x%x", c);
-        strncat(kbuffer, sbuffer, sizeof(kbuffer)-1);
-        statusline(st->wnd_status->handle, kbuffer);
-        if (strlen(kbuffer) > 70)
-          kbuffer[0] = 0;
-      }
-      break;
-  }
+        else {
+            r = NULL;
+        }
+        if (r != NULL) {
+            region2coord(r, &st->cursor);
+            st->wnd_info->update |= 1;
+            st->wnd_status->update |= 1;
+        }
+        break;
+    case 'Q':
+        g_quit = 1;
+        break;
+    default:
+        for (wnd = wnd_first; wnd != NULL; wnd = wnd->next) {
+            if (wnd->handlekey) {
+                if (wnd->handlekey(wnd, st, c))
+                    break;
+            }
+        }
+        if (wnd == NULL) {
+            if (kbuffer[0] == 0) {
+                strcpy(kbuffer, "getch:");
+            }
+            sprintf(sbuffer, " 0x%x", c);
+            strncat(kbuffer, sbuffer, sizeof(kbuffer) - 1);
+            statusline(st->wnd_status->handle, kbuffer);
+            if (strlen(kbuffer) > 70)
+                kbuffer[0] = 0;
+        }
+        break;
+    }
 }
 
 static void init_view(view * display, WINDOW * win)
 {
-  display->topleft.x = 1;
-  display->topleft.y = 1;
-  display->topleft.pl = get_homeplane();
-  display->pl = get_homeplane();
-  display->size.width = getmaxx(win) / TWIDTH;
-  display->size.height = getmaxy(win) / THEIGHT;
-  display->regions =
-    calloc(display->size.height * display->size.width, sizeof(map_region));
+    display->topleft.x = 1;
+    display->topleft.y = 1;
+    display->topleft.pl = get_homeplane();
+    display->pl = get_homeplane();
+    display->size.width = getmaxx(win) / TWIDTH;
+    display->size.height = getmaxy(win) / THEIGHT;
+    display->regions =
+        calloc(display->size.height * display->size.width, sizeof(map_region));
 }
 
 static void update_view(view * vi)
 {
-  int i, j;
-  for (i = 0; i != vi->size.width; ++i) {
-    for (j = 0; j != vi->size.height; ++j) {
-      map_region *mr = mr_get(vi, i, j);
-      mr->coord.x = vi->topleft.x + i - j / 2;
-      mr->coord.y = vi->topleft.y + j;
-      mr->coord.pl = vi->pl;
-      pnormalize(&mr->coord.x, &mr->coord.y, mr->coord.pl);
-      mr->r = findregion(mr->coord.x, mr->coord.y);
+    int i, j;
+    for (i = 0; i != vi->size.width; ++i) {
+        for (j = 0; j != vi->size.height; ++j) {
+            map_region *mr = mr_get(vi, i, j);
+            mr->coord.x = vi->topleft.x + i - j / 2;
+            mr->coord.y = vi->topleft.y + j;
+            mr->coord.pl = vi->pl;
+            pnormalize(&mr->coord.x, &mr->coord.y, mr->coord.pl);
+            mr->r = findregion(mr->coord.x, mr->coord.y);
+        }
     }
-  }
 }
 
 state *state_open(void)
 {
-  state *st = calloc(sizeof(state), 1);
-  st->display.pl = get_homeplane();
-  st->cursor.pl = get_homeplane();
-  st->cursor.x = 0;
-  st->cursor.y = 0;
-  st->selected = calloc(1, sizeof(struct selection));
-  st->modified = 0;
-  st->info_flags = 0xFFFFFFFF;
-  st->prev = current_state;
-  current_state = st;
-  return st;
+    state *st = calloc(sizeof(state), 1);
+    st->display.pl = get_homeplane();
+    st->cursor.pl = get_homeplane();
+    st->cursor.x = 0;
+    st->cursor.y = 0;
+    st->selected = calloc(1, sizeof(struct selection));
+    st->modified = 0;
+    st->info_flags = 0xFFFFFFFF;
+    st->prev = current_state;
+    current_state = st;
+    return st;
 }
 
 void state_close(state * st)
 {
-  assert(st == current_state);
-  current_state = st->prev;
-  free(st);
+    assert(st == current_state);
+    current_state = st->prev;
+    free(st);
 }
 
 void run_mapper(void)
 {
-  WINDOW *hwinstatus;
-  WINDOW *hwininfo;
-  WINDOW *hwinmap;
-  int width, height, x, y;
-  int split = 20, old_flags = log_flags;
-  state *st;
-  point tl;
+    WINDOW *hwinstatus;
+    WINDOW *hwininfo;
+    WINDOW *hwinmap;
+    int width, height, x, y;
+    int split = 20, old_flags = log_flags;
+    state *st;
+    point tl;
 
-  log_flags &= ~(LOG_CPERROR | LOG_CPWARNING);
-  init_curses();
-  curs_set(1);
+    log_flags &= ~(LOG_CPERROR | LOG_CPWARNING);
+    init_curses();
+    curs_set(1);
 
-  set_readline(curses_readline);
+    set_readline(curses_readline);
 
-  getbegyx(stdscr, x, y);
-  width = getmaxx(stdscr);
-  height = getmaxy(stdscr);
+    getbegyx(stdscr, x, y);
+    width = getmaxx(stdscr);
+    height = getmaxy(stdscr);
 
-  hwinmap = subwin(stdscr, getmaxy(stdscr) - 1, getmaxx(stdscr) - split, y, x);
-  hwininfo =
-    subwin(stdscr, getmaxy(stdscr) - 1, split, y, x + getmaxx(stdscr) - split);
-  hwinstatus = subwin(stdscr, 1, width, height - 1, x);
+    hwinmap = subwin(stdscr, getmaxy(stdscr) - 1, getmaxx(stdscr) - split, y, x);
+    hwininfo =
+        subwin(stdscr, getmaxy(stdscr) - 1, split, y, x + getmaxx(stdscr) - split);
+    hwinstatus = subwin(stdscr, 1, width, height - 1, x);
 
-  st = state_open();
-  st->wnd_map = win_create(hwinmap);
-  st->wnd_map->paint = &paint_map;
-  st->wnd_map->update = 1;
-  st->wnd_info = win_create(hwininfo);
-  st->wnd_info->paint = &paint_info_default;
-  st->wnd_info->handlekey = &handle_info_region;
-  st->wnd_info->update = 1;
-  st->wnd_status = win_create(hwinstatus);
-  st->wnd_status->paint = &paint_status;
-  st->wnd_status->update = 1;
+    st = state_open();
+    st->wnd_map = win_create(hwinmap);
+    st->wnd_map->paint = &paint_map;
+    st->wnd_map->update = 1;
+    st->wnd_info = win_create(hwininfo);
+    st->wnd_info->paint = &paint_info_default;
+    st->wnd_info->handlekey = &handle_info_region;
+    st->wnd_info->update = 1;
+    st->wnd_status = win_create(hwinstatus);
+    st->wnd_status->paint = &paint_status;
+    st->wnd_status->update = 1;
 
-  init_view(&st->display, hwinmap);
-  coor2point(&st->display.topleft, &tl);
+    init_view(&st->display, hwinmap);
+    coor2point(&st->display.topleft, &tl);
 
-  hstatus = st->wnd_status->handle;     /* the lua console needs this */
+    hstatus = st->wnd_status->handle;     /* the lua console needs this */
 
-  while (!g_quit) {
-    int c;
-    point p;
-    window *wnd;
-    view *vi = &st->display;
+    while (!g_quit) {
+        int c;
+        point p;
+        window *wnd;
+        view *vi = &st->display;
 
-    getbegyx(hwinmap, x, y);
-    width = getmaxx(hwinmap) - x;
-    height = getmaxy(hwinmap) - y;
-    coor2point(&st->cursor, &p);
+        getbegyx(hwinmap, x, y);
+        width = getmaxx(hwinmap) - x;
+        height = getmaxy(hwinmap) - y;
+        coor2point(&st->cursor, &p);
 
-    if (st->cursor.pl != vi->pl) {
-      vi->pl = st->cursor.pl;
-      st->wnd_map->update |= 1;
-    }
-    if (p.y < tl.y) {
-      vi->topleft.y = st->cursor.y - vi->size.height / 2;
-      st->wnd_map->update |= 1;
-    } else if (p.y >= tl.y + vi->size.height * THEIGHT) {
-      vi->topleft.y = st->cursor.y - vi->size.height / 2;
-      st->wnd_map->update |= 1;
-    }
-    if (p.x <= tl.x) {
-      vi->topleft.x =
-        st->cursor.x + (st->cursor.y - vi->topleft.y) / 2 - vi->size.width / 2;
-      st->wnd_map->update |= 1;
-    } else if (p.x >= tl.x + vi->size.width * TWIDTH - 1) {
-      vi->topleft.x =
-        st->cursor.x + (st->cursor.y - vi->topleft.y) / 2 - vi->size.width / 2;
-      st->wnd_map->update |= 1;
-    }
-
-    if (st->wnd_map->update) {
-      update_view(vi);
-      coor2point(&vi->topleft, &tl);
-    }
-    for (wnd = wnd_last; wnd != NULL; wnd = wnd->prev) {
-      if (wnd->update && wnd->paint) {
-        if (wnd->update & 1) {
-          wnd->paint(wnd, st);
-          wnoutrefresh(wnd->handle);
+        if (st->cursor.pl != vi->pl) {
+            vi->pl = st->cursor.pl;
+            st->wnd_map->update |= 1;
         }
-        if (wnd->update & 2) {
-          touchwin(wnd->handle);
+        if (p.y < tl.y) {
+            vi->topleft.y = st->cursor.y - vi->size.height / 2;
+            st->wnd_map->update |= 1;
         }
-        wnd->update = 0;
-      }
+        else if (p.y >= tl.y + vi->size.height * THEIGHT) {
+            vi->topleft.y = st->cursor.y - vi->size.height / 2;
+            st->wnd_map->update |= 1;
+        }
+        if (p.x <= tl.x) {
+            vi->topleft.x =
+                st->cursor.x + (st->cursor.y - vi->topleft.y) / 2 - vi->size.width / 2;
+            st->wnd_map->update |= 1;
+        }
+        else if (p.x >= tl.x + vi->size.width * TWIDTH - 1) {
+            vi->topleft.x =
+                st->cursor.x + (st->cursor.y - vi->topleft.y) / 2 - vi->size.width / 2;
+            st->wnd_map->update |= 1;
+        }
+
+        if (st->wnd_map->update) {
+            update_view(vi);
+            coor2point(&vi->topleft, &tl);
+        }
+        for (wnd = wnd_last; wnd != NULL; wnd = wnd->prev) {
+            if (wnd->update && wnd->paint) {
+                if (wnd->update & 1) {
+                    wnd->paint(wnd, st);
+                    wnoutrefresh(wnd->handle);
+                }
+                if (wnd->update & 2) {
+                    touchwin(wnd->handle);
+                }
+                wnd->update = 0;
+            }
+        }
+        draw_cursor(st->wnd_map->handle, st->selected, vi, &st->cursor, 1);
+        doupdate();
+        c = getch();
+        draw_cursor(st->wnd_map->handle, st->selected, vi, &st->cursor, 0);
+        handlekey(st, c);
     }
-    draw_cursor(st->wnd_map->handle, st->selected, vi, &st->cursor, 1);
-    doupdate();
-    c = getch();
-    draw_cursor(st->wnd_map->handle, st->selected, vi, &st->cursor, 0);
-    handlekey(st, c);
-  }
-  g_quit = 0;
-  set_readline(NULL);
-  curs_set(1);
-  endwin();
-  log_flags = old_flags;
-  state_close(st);
+    g_quit = 0;
+    set_readline(NULL);
+    curs_set(1);
+    endwin();
+    log_flags = old_flags;
+    state_close(st);
 }
 
 int
 curses_readline(struct lua_State *L, char *buffer, size_t size,
-  const char *prompt)
+const char *prompt)
 {
-  unused_arg(L);
-  askstring(hstatus, prompt, buffer, size);
-  return buffer[0] != 0;
+    unused_arg(L);
+    askstring(hstatus, prompt, buffer, size);
+    return buffer[0] != 0;
 }
 
 void seed_players(const char *filename, bool new_island)
 {
-  newfaction *players = read_newfactions(filename);
-  if (players != NULL) {
-    while (players) {
-      int n = listlen(players);
-      int k = (n + ISLANDSIZE - 1) / ISLANDSIZE;
-      k = n / k;
-      n = autoseed(&players, k, new_island ? 0 : TURNS_PER_ISLAND);
-      if (n == 0) {
-        break;
-      }
+    newfaction *players = read_newfactions(filename);
+    if (players != NULL) {
+        while (players) {
+            int n = listlen(players);
+            int k = (n + ISLANDSIZE - 1) / ISLANDSIZE;
+            k = n / k;
+            n = autoseed(&players, k, new_island ? 0 : TURNS_PER_ISLAND);
+            if (n == 0) {
+                break;
+            }
+        }
     }
-  }
 }
 
 void make_block(int x, int y, int radius, const struct terrain_type *terrain)
 {
-  int cx, cy;
-  region *r;
-  plane *pl = findplane(x, y);
+    int cx, cy;
+    region *r;
+    plane *pl = findplane(x, y);
 
-  if (terrain == NULL)
-    return;
+    if (terrain == NULL)
+        return;
 
-  for (cx = x - radius; cx != x + radius; ++cx) {
-    for (cy = y - radius; cy != y + radius; ++cy) {
-      int nx = cx, ny = cy;
-      pnormalize(&nx, &ny, pl);
-      if (koor_distance(nx, ny, x, y) < radius) {
-        if (!findregion(nx, ny)) {
-          r = new_region(nx, ny, pl, 0);
-          terraform_region(r, terrain);
+    for (cx = x - radius; cx != x + radius; ++cx) {
+        for (cy = y - radius; cy != y + radius; ++cy) {
+            int nx = cx, ny = cy;
+            pnormalize(&nx, &ny, pl);
+            if (koor_distance(nx, ny, x, y) < radius) {
+                if (!findregion(nx, ny)) {
+                    r = new_region(nx, ny, pl, 0);
+                    terraform_region(r, terrain);
+                }
+            }
         }
-      }
     }
-  }
 }
diff --git a/src/gmtool.h b/src/gmtool.h
index 4e3570de2..ae2cea39a 100644
--- a/src/gmtool.h
+++ b/src/gmtool.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  * +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  * |                   |  Enno Rehling <enno@eressea.de>
  * | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
diff --git a/src/gmtool_structs.h b/src/gmtool_structs.h
index 1f3e4e9a7..b6003313c 100644
--- a/src/gmtool_structs.h
+++ b/src/gmtool_structs.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  * +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  * |                   |  Enno Rehling <enno@eressea.de>
  * | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
diff --git a/src/helpers.c b/src/helpers.c
index e37865be5..4690023e9 100644
--- a/src/helpers.c
+++ b/src/helpers.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
 +-------------------+
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Christian Schlittchen <corwin@amber.kn-bremen.de>
@@ -44,474 +44,502 @@ without prior permission by the authors of Eressea.
 static int
 lua_giveitem(unit * s, unit * d, const item_type * itype, int n, struct order *ord)
 {
-  lua_State *L = (lua_State *) global.vm_state;
-  char fname[64];
-  int result = -1;
-  const char *iname = itype->rtype->_name;
+    lua_State *L = (lua_State *)global.vm_state;
+    char fname[64];
+    int result = -1;
+    const char *iname = itype->rtype->_name;
 
-  assert(s != NULL);
-  strlcpy(fname, iname, sizeof(fname));
-  strlcat(fname, "_give", sizeof(fname));
+    assert(s != NULL);
+    strlcpy(fname, iname, sizeof(fname));
+    strlcat(fname, "_give", sizeof(fname));
 
-  lua_getglobal(L, fname);
-  if (lua_isfunction(L, -1)) {
-    tolua_pushusertype(L, s, TOLUA_CAST "unit");
-    tolua_pushusertype(L, d, TOLUA_CAST "unit");
-    tolua_pushstring(L, iname);
-    tolua_pushnumber(L, (lua_Number) n);
+    lua_getglobal(L, fname);
+    if (lua_isfunction(L, -1)) {
+        tolua_pushusertype(L, s, TOLUA_CAST "unit");
+        tolua_pushusertype(L, d, TOLUA_CAST "unit");
+        tolua_pushstring(L, iname);
+        tolua_pushnumber(L, (lua_Number)n);
 
-    if (lua_pcall(L, 4, 1, 0) != 0) {
-      const char *error = lua_tostring(L, -1);
-      log_error("unit %s calling '%s': %s.\n", unitname(s), fname, error);
-      lua_pop(L, 1);
-    } else {
-      result = (int)lua_tonumber(L, -1);
-      lua_pop(L, 1);
+        if (lua_pcall(L, 4, 1, 0) != 0) {
+            const char *error = lua_tostring(L, -1);
+            log_error("unit %s calling '%s': %s.\n", unitname(s), fname, error);
+            lua_pop(L, 1);
+        }
+        else {
+            result = (int)lua_tonumber(L, -1);
+            lua_pop(L, 1);
+        }
+    }
+    else {
+        log_error("unit %s trying to call '%s' : not a function.\n", unitname(s), fname);
+        lua_pop(L, 1);
     }
-  } else {
-    log_error("unit %s trying to call '%s' : not a function.\n", unitname(s), fname);
-    lua_pop(L, 1);
-  }
 
-  return result;
+    return result;
 }
 
 static int limit_resource(const region * r, const resource_type * rtype)
 {
-  char fname[64];
-  int result = -1;
-  lua_State *L = (lua_State *) global.vm_state;
+    char fname[64];
+    int result = -1;
+    lua_State *L = (lua_State *)global.vm_state;
 
-  strlcpy(fname, rtype->_name, sizeof(fname));
-  strlcat(fname, "_limit", sizeof(fname));
+    strlcpy(fname, rtype->_name, sizeof(fname));
+    strlcat(fname, "_limit", sizeof(fname));
 
-  lua_getglobal(L, fname);
-  if (lua_isfunction(L, -1)) {
-    tolua_pushusertype(L, (void *)r, TOLUA_CAST "region");
+    lua_getglobal(L, fname);
+    if (lua_isfunction(L, -1)) {
+        tolua_pushusertype(L, (void *)r, TOLUA_CAST "region");
 
-    if (lua_pcall(L, 1, 1, 0) != 0) {
-      const char *error = lua_tostring(L, -1);
-      log_error("limit(%s) calling '%s': %s.\n", regionname(r, NULL), fname, error);
-      lua_pop(L, 1);
-    } else {
-      result = (int)lua_tonumber(L, -1);
-      lua_pop(L, 1);
+        if (lua_pcall(L, 1, 1, 0) != 0) {
+            const char *error = lua_tostring(L, -1);
+            log_error("limit(%s) calling '%s': %s.\n", regionname(r, NULL), fname, error);
+            lua_pop(L, 1);
+        }
+        else {
+            result = (int)lua_tonumber(L, -1);
+            lua_pop(L, 1);
+        }
+    }
+    else {
+        log_error("limit(%s) calling '%s': not a function.\n", regionname(r, NULL), fname);
+        lua_pop(L, 1);
     }
-  } else {
-    log_error("limit(%s) calling '%s': not a function.\n", regionname(r, NULL), fname);
-    lua_pop(L, 1);
-  }
 
-  return result;
+    return result;
 }
 
 static void
 produce_resource(region * r, const resource_type * rtype, int norders)
 {
-  lua_State *L = (lua_State *) global.vm_state;
-  char fname[64];
+    lua_State *L = (lua_State *)global.vm_state;
+    char fname[64];
 
-  strlcpy(fname, rtype->_name, sizeof(fname));
-  strlcat(fname, "_produce", sizeof(fname));
+    strlcpy(fname, rtype->_name, sizeof(fname));
+    strlcat(fname, "_produce", sizeof(fname));
 
-  lua_getglobal(L, fname);
-  if (lua_isfunction(L, -1)) {
-    tolua_pushusertype(L, (void *)r, TOLUA_CAST "region");
-    tolua_pushnumber(L, (lua_Number) norders);
+    lua_getglobal(L, fname);
+    if (lua_isfunction(L, -1)) {
+        tolua_pushusertype(L, (void *)r, TOLUA_CAST "region");
+        tolua_pushnumber(L, (lua_Number)norders);
 
-    if (lua_pcall(L, 2, 0, 0) != 0) {
-      const char *error = lua_tostring(L, -1);
-      log_error("produce(%s) calling '%s': %s.\n", regionname(r, NULL), fname, error);
-      lua_pop(L, 1);
+        if (lua_pcall(L, 2, 0, 0) != 0) {
+            const char *error = lua_tostring(L, -1);
+            log_error("produce(%s) calling '%s': %s.\n", regionname(r, NULL), fname, error);
+            lua_pop(L, 1);
+        }
+    }
+    else {
+        log_error("produce(%s) calling '%s': not a function.\n", regionname(r, NULL), fname);
+        lua_pop(L, 1);
     }
-  } else {
-    log_error("produce(%s) calling '%s': not a function.\n", regionname(r, NULL), fname);
-    lua_pop(L, 1);
-  }
 }
 
 static void push_param(lua_State * L, char c, spllprm * param)
 {
-  if (c == 'u')
-    tolua_pushusertype(L, param->data.u, "unit");
-  else if (c == 'b')
-    tolua_pushusertype(L, param->data.b, "building");
-  else if (c == 's')
-    tolua_pushusertype(L, param->data.sh, "ship");
-  else if (c == 'r')
-    tolua_pushusertype(L, param->data.sh, "region");
-  else if (c == 'c')
-    tolua_pushstring(L, param->data.s);
-  else {
-    log_error("unsupported syntax %c.\n", c);
-    lua_pushnil(L);
-  }
+    if (c == 'u')
+        tolua_pushusertype(L, param->data.u, "unit");
+    else if (c == 'b')
+        tolua_pushusertype(L, param->data.b, "building");
+    else if (c == 's')
+        tolua_pushusertype(L, param->data.sh, "ship");
+    else if (c == 'r')
+        tolua_pushusertype(L, param->data.sh, "region");
+    else if (c == 'c')
+        tolua_pushstring(L, param->data.s);
+    else {
+        log_error("unsupported syntax %c.\n", c);
+        lua_pushnil(L);
+    }
 }
 
 /** callback to use lua for spell functions */
 static int lua_callspell(castorder * co)
 {
-  lua_State *L = (lua_State *) global.vm_state;
-  const char *fname = co->sp->sname;
-  unit *caster = co_get_caster(co);
-  region * r = co_get_region(co);
-  int result = -1;
-  const char *hashpos = strchr(fname, '#');
-  char fbuf[64];
+    lua_State *L = (lua_State *)global.vm_state;
+    const char *fname = co->sp->sname;
+    unit *caster = co_get_caster(co);
+    region * r = co_get_region(co);
+    int result = -1;
+    const char *hashpos = strchr(fname, '#');
+    char fbuf[64];
 
-  if (hashpos != NULL) {
-    ptrdiff_t len = hashpos - fname;
-    assert(len < (ptrdiff_t) sizeof(fbuf));
-    strncpy(fbuf, fname, len);
-    fbuf[len] = '\0';
-    fname = fbuf;
-  }
+    if (hashpos != NULL) {
+        ptrdiff_t len = hashpos - fname;
+        assert(len < (ptrdiff_t) sizeof(fbuf));
+        strncpy(fbuf, fname, len);
+        fbuf[len] = '\0';
+        fname = fbuf;
+    }
 
-  lua_getglobal(L, fname);
-  if (lua_isfunction(L, -1)) {
-    int nparam = 4;
-    tolua_pushusertype(L, r, TOLUA_CAST "region");
-    tolua_pushusertype(L, caster, TOLUA_CAST "unit");
-    tolua_pushnumber(L, (lua_Number) co->level);
-    tolua_pushnumber(L, (lua_Number) co->force);
-    if (co->sp->parameter && co->par->length) {
-      const char *synp = co->sp->parameter;
-      int i = 0;
-      ++nparam;
-      lua_newtable(L);
-      while (*synp && i < co->par->length) {
-        spllprm *param = co->par->param[i];
-        char c = *synp;
-        if (c == '+') {
-          push_param(L, *(synp - 1), param);
-        } else {
-          push_param(L, c, param);
-          ++synp;
+    lua_getglobal(L, fname);
+    if (lua_isfunction(L, -1)) {
+        int nparam = 4;
+        tolua_pushusertype(L, r, TOLUA_CAST "region");
+        tolua_pushusertype(L, caster, TOLUA_CAST "unit");
+        tolua_pushnumber(L, (lua_Number)co->level);
+        tolua_pushnumber(L, (lua_Number)co->force);
+        if (co->sp->parameter && co->par->length) {
+            const char *synp = co->sp->parameter;
+            int i = 0;
+            ++nparam;
+            lua_newtable(L);
+            while (*synp && i < co->par->length) {
+                spllprm *param = co->par->param[i];
+                char c = *synp;
+                if (c == '+') {
+                    push_param(L, *(synp - 1), param);
+                }
+                else {
+                    push_param(L, c, param);
+                    ++synp;
+                }
+                lua_rawseti(L, -2, ++i);
+            }
         }
-        lua_rawseti(L, -2, ++i);
-      }
+
+        if (lua_pcall(L, nparam, 1, 0) != 0) {
+            const char *error = lua_tostring(L, -1);
+            log_error("spell(%s) calling '%s': %s.\n", unitname(caster), fname, error);
+            lua_pop(L, 1);
+        }
+        else {
+            result = (int)lua_tonumber(L, -1);
+            lua_pop(L, 1);
+        }
+    }
+    else {
+        int ltype = lua_type(L, -1);
+        log_error("spell(%s) calling '%s': not a function, has type %d.\n", unitname(caster), fname, ltype);
+        lua_pop(L, 1);
     }
 
-    if (lua_pcall(L, nparam, 1, 0) != 0) {
-      const char *error = lua_tostring(L, -1);
-      log_error("spell(%s) calling '%s': %s.\n", unitname(caster), fname, error);
-      lua_pop(L, 1);
-    } else {
-      result = (int)lua_tonumber(L, -1);
-      lua_pop(L, 1);
-    }
-  } else {
-    int ltype = lua_type(L, -1);
-    log_error("spell(%s) calling '%s': not a function, has type %d.\n", unitname(caster), fname, ltype);
-    lua_pop(L, 1);
-  }
-
-  return result;
+    return result;
 }
 
 /** callback to initialize a familiar from lua. */
 static int lua_initfamiliar(unit * u)
 {
-  lua_State *L = (lua_State *) global.vm_state;
-  char fname[64];
-  int result = -1;
+    lua_State *L = (lua_State *)global.vm_state;
+    char fname[64];
+    int result = -1;
 
-  strlcpy(fname, "initfamiliar_", sizeof(fname));
-  strlcat(fname, u_race(u)->_name, sizeof(fname));
+    strlcpy(fname, "initfamiliar_", sizeof(fname));
+    strlcat(fname, u_race(u)->_name, sizeof(fname));
 
-  lua_getglobal(L, fname);
-  if (lua_isfunction(L, -1)) {
-    tolua_pushusertype(L, u, TOLUA_CAST "unit");
+    lua_getglobal(L, fname);
+    if (lua_isfunction(L, -1)) {
+        tolua_pushusertype(L, u, TOLUA_CAST "unit");
 
-    if (lua_pcall(L, 1, 1, 0) != 0) {
-      const char *error = lua_tostring(L, -1);
-      log_error("familiar(%s) calling '%s': %s.\n", unitname(u), fname, error);
-      lua_pop(L, 1);
-    } else {
-      result = (int)lua_tonumber(L, -1);
-      lua_pop(L, 1);
+        if (lua_pcall(L, 1, 1, 0) != 0) {
+            const char *error = lua_tostring(L, -1);
+            log_error("familiar(%s) calling '%s': %s.\n", unitname(u), fname, error);
+            lua_pop(L, 1);
+        }
+        else {
+            result = (int)lua_tonumber(L, -1);
+            lua_pop(L, 1);
+        }
+    }
+    else {
+        log_warning("familiar(%s) calling '%s': not a function.\n", unitname(u), fname);
+        lua_pop(L, 1);
     }
-  } else {
-    log_warning("familiar(%s) calling '%s': not a function.\n", unitname(u), fname);
-    lua_pop(L, 1);
-  }
 
-  create_mage(u, M_GRAY);
+    create_mage(u, M_GRAY);
 
-  strlcpy(fname, u_race(u)->_name, sizeof(fname));
-  strlcat(fname, "_familiar", sizeof(fname));
-  equip_unit(u, get_equipment(fname));
-  return result;
+    strlcpy(fname, u_race(u)->_name, sizeof(fname));
+    strlcat(fname, "_familiar", sizeof(fname));
+    equip_unit(u, get_equipment(fname));
+    return result;
 }
 
 static int
 lua_changeresource(unit * u, const struct resource_type *rtype, int delta)
 {
-  lua_State *L = (lua_State *) global.vm_state;
-  int result = -1;
-  char fname[64];
+    lua_State *L = (lua_State *)global.vm_state;
+    int result = -1;
+    char fname[64];
 
-  strlcpy(fname, rtype->_name, sizeof(fname));
-  strlcat(fname, "_changeresource", sizeof(fname));
+    strlcpy(fname, rtype->_name, sizeof(fname));
+    strlcat(fname, "_changeresource", sizeof(fname));
 
-  lua_getglobal(L, fname);
-  if (lua_isfunction(L, -1)) {
-    tolua_pushusertype(L, u, TOLUA_CAST "unit");
-    tolua_pushnumber(L, (lua_Number) delta);
+    lua_getglobal(L, fname);
+    if (lua_isfunction(L, -1)) {
+        tolua_pushusertype(L, u, TOLUA_CAST "unit");
+        tolua_pushnumber(L, (lua_Number)delta);
 
-    if (lua_pcall(L, 2, 1, 0) != 0) {
-      const char *error = lua_tostring(L, -1);
-      log_error("change(%s) calling '%s': %s.\n", unitname(u), fname, error);
-      lua_pop(L, 1);
-    } else {
-      result = (int)lua_tonumber(L, -1);
-      lua_pop(L, 1);
+        if (lua_pcall(L, 2, 1, 0) != 0) {
+            const char *error = lua_tostring(L, -1);
+            log_error("change(%s) calling '%s': %s.\n", unitname(u), fname, error);
+            lua_pop(L, 1);
+        }
+        else {
+            result = (int)lua_tonumber(L, -1);
+            lua_pop(L, 1);
+        }
+    }
+    else {
+        log_error("change(%s) calling '%s': not a function.\n", unitname(u), fname);
+        lua_pop(L, 1);
     }
-  } else {
-    log_error("change(%s) calling '%s': not a function.\n", unitname(u), fname);
-    lua_pop(L, 1);
-  }
 
-  return result;
+    return result;
 }
 
 static int lua_getresource(unit * u, const struct resource_type *rtype)
 {
-  lua_State *L = (lua_State *) global.vm_state;
-  int result = -1;
-  char fname[64];
+    lua_State *L = (lua_State *)global.vm_state;
+    int result = -1;
+    char fname[64];
 
-  strlcpy(fname, rtype->_name, sizeof(fname));
-  strlcat(fname, "_getresource", sizeof(fname));
+    strlcpy(fname, rtype->_name, sizeof(fname));
+    strlcat(fname, "_getresource", sizeof(fname));
 
-  lua_getglobal(L, fname);
-  if (lua_isfunction(L, -1)) {
-    tolua_pushusertype(L, u, TOLUA_CAST "unit");
+    lua_getglobal(L, fname);
+    if (lua_isfunction(L, -1)) {
+        tolua_pushusertype(L, u, TOLUA_CAST "unit");
 
-    if (lua_pcall(L, 1, 1, 0) != 0) {
-      const char *error = lua_tostring(L, -1);
-      log_error("get(%s) calling '%s': %s.\n", unitname(u), fname, error);
-      lua_pop(L, 1);
-    } else {
-      result = (int)lua_tonumber(L, -1);
-      lua_pop(L, 1);
+        if (lua_pcall(L, 1, 1, 0) != 0) {
+            const char *error = lua_tostring(L, -1);
+            log_error("get(%s) calling '%s': %s.\n", unitname(u), fname, error);
+            lua_pop(L, 1);
+        }
+        else {
+            result = (int)lua_tonumber(L, -1);
+            lua_pop(L, 1);
+        }
+    }
+    else {
+        log_error("get(%s) calling '%s': not a function.\n", unitname(u), fname);
+        lua_pop(L, 1);
     }
-  } else {
-    log_error("get(%s) calling '%s': not a function.\n", unitname(u), fname);
-    lua_pop(L, 1);
-  }
 
-  return result;
+    return result;
 }
 
 static bool lua_canuse_item(const unit * u, const struct item_type *itype)
 {
-  static int function_exists = 1;
-  bool result = true;
+    static int function_exists = 1;
+    bool result = true;
 
-  if (function_exists) {
-    lua_State *L = (lua_State *) global.vm_state;
-    const char *fname = "item_canuse";
+    if (function_exists) {
+        lua_State *L = (lua_State *)global.vm_state;
+        const char *fname = "item_canuse";
 
-    lua_getglobal(L, fname);
-    if (lua_isfunction(L, -1)) {
-      tolua_pushusertype(L, (void *)u, TOLUA_CAST "unit");
-      tolua_pushstring(L, itype->rtype->_name);
+        lua_getglobal(L, fname);
+        if (lua_isfunction(L, -1)) {
+            tolua_pushusertype(L, (void *)u, TOLUA_CAST "unit");
+            tolua_pushstring(L, itype->rtype->_name);
 
-      if (lua_pcall(L, 2, 1, 0) != 0) {
-        const char *error = lua_tostring(L, -1);
-        log_error("get(%s) calling '%s': %s.\n", unitname(u), fname, error);
-        lua_pop(L, 1);
-      } else {
-        result = lua_toboolean(L, -1);
-        lua_pop(L, 1);
-      }
-    } else {
-      function_exists = 0;
-      log_error("get(%s) calling '%s': not a function.\n", unitname(u), fname);
-      lua_pop(L, 1);
+            if (lua_pcall(L, 2, 1, 0) != 0) {
+                const char *error = lua_tostring(L, -1);
+                log_error("get(%s) calling '%s': %s.\n", unitname(u), fname, error);
+                lua_pop(L, 1);
+            }
+            else {
+                result = lua_toboolean(L, -1);
+                lua_pop(L, 1);
+            }
+        }
+        else {
+            function_exists = 0;
+            log_error("get(%s) calling '%s': not a function.\n", unitname(u), fname);
+            lua_pop(L, 1);
+        }
     }
-  }
-  return result;
+    return result;
 }
 
 static int
 lua_wage(const region * r, const faction * f, const race * rc, int in_turn)
 {
-  lua_State *L = (lua_State *) global.vm_state;
-  const char *fname = "wage";
-  int result = -1;
+    lua_State *L = (lua_State *)global.vm_state;
+    const char *fname = "wage";
+    int result = -1;
 
-  lua_getglobal(L, fname);
-  if (lua_isfunction(L, -1)) {
-    tolua_pushusertype(L, (void *)r, TOLUA_CAST "region");
-    tolua_pushusertype(L, (void *)f, TOLUA_CAST "faction");
-    tolua_pushstring(L, rc ? rc->_name : 0);
-    tolua_pushnumber(L, (lua_Number) in_turn);
+    lua_getglobal(L, fname);
+    if (lua_isfunction(L, -1)) {
+        tolua_pushusertype(L, (void *)r, TOLUA_CAST "region");
+        tolua_pushusertype(L, (void *)f, TOLUA_CAST "faction");
+        tolua_pushstring(L, rc ? rc->_name : 0);
+        tolua_pushnumber(L, (lua_Number)in_turn);
 
-    if (lua_pcall(L, 3, 1, 0) != 0) {
-      const char *error = lua_tostring(L, -1);
-      log_error("wage(%s) calling '%s': %s.\n", regionname(r, NULL), fname, error);
-      lua_pop(L, 1);
-    } else {
-      result = (int)lua_tonumber(L, -1);
-      lua_pop(L, 1);
+        if (lua_pcall(L, 3, 1, 0) != 0) {
+            const char *error = lua_tostring(L, -1);
+            log_error("wage(%s) calling '%s': %s.\n", regionname(r, NULL), fname, error);
+            lua_pop(L, 1);
+        }
+        else {
+            result = (int)lua_tonumber(L, -1);
+            lua_pop(L, 1);
+        }
+    }
+    else {
+        log_error("wage(%s) calling '%s': not a function.\n", regionname(r, NULL), fname);
+        lua_pop(L, 1);
     }
-  } else {
-    log_error("wage(%s) calling '%s': not a function.\n", regionname(r, NULL), fname);
-    lua_pop(L, 1);
-  }
 
-  return result;
+    return result;
 }
 
 static void lua_agebuilding(building * b)
 {
-  lua_State *L = (lua_State *) global.vm_state;
-  char fname[64];
+    lua_State *L = (lua_State *)global.vm_state;
+    char fname[64];
 
-  strlcpy(fname, "age_", sizeof(fname));
-  strlcat(fname, b->type->_name, sizeof(fname));
+    strlcpy(fname, "age_", sizeof(fname));
+    strlcat(fname, b->type->_name, sizeof(fname));
 
-  lua_getglobal(L, fname);
-  if (lua_isfunction(L, -1)) {
-    tolua_pushusertype(L, (void *)b, TOLUA_CAST "building");
+    lua_getglobal(L, fname);
+    if (lua_isfunction(L, -1)) {
+        tolua_pushusertype(L, (void *)b, TOLUA_CAST "building");
 
-    if (lua_pcall(L, 1, 0, 0) != 0) {
-      const char *error = lua_tostring(L, -1);
-      log_error("agebuilding(%s) calling '%s': %s.\n", buildingname(b), fname, error);
-      lua_pop(L, 1);
+        if (lua_pcall(L, 1, 0, 0) != 0) {
+            const char *error = lua_tostring(L, -1);
+            log_error("agebuilding(%s) calling '%s': %s.\n", buildingname(b), fname, error);
+            lua_pop(L, 1);
+        }
+    }
+    else {
+        log_error("agebuilding(%s) calling '%s': not a function.\n", buildingname(b), fname);
+        lua_pop(L, 1);
     }
-  } else {
-    log_error("agebuilding(%s) calling '%s': not a function.\n", buildingname(b), fname);
-    lua_pop(L, 1);
-  }
 }
 
 static double lua_building_taxes(building * b, int level)
 {
-  lua_State *L = (lua_State *) global.vm_state;
-  const char *fname = "building_taxes";
-  double result = 0.0F;
+    lua_State *L = (lua_State *)global.vm_state;
+    const char *fname = "building_taxes";
+    double result = 0.0F;
 
-  lua_getglobal(L, fname);
-  if (lua_isfunction(L, -1)) {
-    tolua_pushusertype(L, (void *)b, TOLUA_CAST "building");
-    tolua_pushnumber(L, level);
+    lua_getglobal(L, fname);
+    if (lua_isfunction(L, -1)) {
+        tolua_pushusertype(L, (void *)b, TOLUA_CAST "building");
+        tolua_pushnumber(L, level);
 
-    if (lua_pcall(L, 2, 1, 0) != 0) {
-      const char *error = lua_tostring(L, -1);
-      log_error("building_taxes(%s) calling '%s': %s.\n", buildingname(b), fname, error);
-      lua_pop(L, 1);
-    } else {
-      result = (double)lua_tonumber(L, -1);
-      lua_pop(L, 1);
+        if (lua_pcall(L, 2, 1, 0) != 0) {
+            const char *error = lua_tostring(L, -1);
+            log_error("building_taxes(%s) calling '%s': %s.\n", buildingname(b), fname, error);
+            lua_pop(L, 1);
+        }
+        else {
+            result = (double)lua_tonumber(L, -1);
+            lua_pop(L, 1);
+        }
     }
-  } else {
-    log_error("building_taxes(%s) calling '%s': not a function.\n", buildingname(b), fname);
-    lua_pop(L, 1);
-  }
-  return result;
+    else {
+        log_error("building_taxes(%s) calling '%s': not a function.\n", buildingname(b), fname);
+        lua_pop(L, 1);
+    }
+    return result;
 }
 
 static int lua_maintenance(const unit * u)
 {
-  lua_State *L = (lua_State *) global.vm_state;
-  const char *fname = "maintenance";
-  int result = -1;
+    lua_State *L = (lua_State *)global.vm_state;
+    const char *fname = "maintenance";
+    int result = -1;
 
-  lua_getglobal(L, fname);
-  if (lua_isfunction(L, -1)) {
-    tolua_pushusertype(L, (void *)u, TOLUA_CAST "unit");
+    lua_getglobal(L, fname);
+    if (lua_isfunction(L, -1)) {
+        tolua_pushusertype(L, (void *)u, TOLUA_CAST "unit");
 
-    if (lua_pcall(L, 1, 1, 0) != 0) {
-      const char *error = lua_tostring(L, -1);
-      log_error("maintenance(%s) calling '%s': %s.\n", unitname(u), fname, error);
-      lua_pop(L, 1);
-    } else {
-      result = (int)lua_tonumber(L, -1);
-      lua_pop(L, 1);
+        if (lua_pcall(L, 1, 1, 0) != 0) {
+            const char *error = lua_tostring(L, -1);
+            log_error("maintenance(%s) calling '%s': %s.\n", unitname(u), fname, error);
+            lua_pop(L, 1);
+        }
+        else {
+            result = (int)lua_tonumber(L, -1);
+            lua_pop(L, 1);
+        }
+    }
+    else {
+        log_error("maintenance(%s) calling '%s': not a function.\n", unitname(u), fname);
+        lua_pop(L, 1);
     }
-  } else {
-    log_error("maintenance(%s) calling '%s': not a function.\n", unitname(u), fname);
-    lua_pop(L, 1);
-  }
 
-  return result;
+    return result;
 }
 
 static int lua_equipmentcallback(const struct equipment *eq, unit * u)
 {
-  lua_State *L = (lua_State *) global.vm_state;
-  char fname[64];
-  int result = -1;
+    lua_State *L = (lua_State *)global.vm_state;
+    char fname[64];
+    int result = -1;
 
-  strlcpy(fname, "equip_", sizeof(fname));
-  strlcat(fname, eq->name, sizeof(fname));
+    strlcpy(fname, "equip_", sizeof(fname));
+    strlcat(fname, eq->name, sizeof(fname));
 
-  lua_getglobal(L, fname);
-  if (lua_isfunction(L, -1)) {
-    tolua_pushusertype(L, (void *)u, TOLUA_CAST "unit");
+    lua_getglobal(L, fname);
+    if (lua_isfunction(L, -1)) {
+        tolua_pushusertype(L, (void *)u, TOLUA_CAST "unit");
 
-    if (lua_pcall(L, 1, 1, 0) != 0) {
-      const char *error = lua_tostring(L, -1);
-      log_error("equip(%s) calling '%s': %s.\n", unitname(u), fname, error);
-      lua_pop(L, 1);
-    } else {
-      result = (int)lua_tonumber(L, -1);
-      lua_pop(L, 1);
+        if (lua_pcall(L, 1, 1, 0) != 0) {
+            const char *error = lua_tostring(L, -1);
+            log_error("equip(%s) calling '%s': %s.\n", unitname(u), fname, error);
+            lua_pop(L, 1);
+        }
+        else {
+            result = (int)lua_tonumber(L, -1);
+            lua_pop(L, 1);
+        }
     }
-  } else {
-    log_error("equip(%s) calling '%s': not a function.\n", unitname(u), fname);
-    lua_pop(L, 1);
-  }
-  return result;
+    else {
+        log_error("equip(%s) calling '%s': not a function.\n", unitname(u), fname);
+        lua_pop(L, 1);
+    }
+    return result;
 }
 
 /** callback for an item-use function written in lua. */
 int
 lua_useitem(struct unit *u, const struct item_type *itype, int amount,
-  struct order *ord)
+struct order *ord)
 {
-  lua_State *L = (lua_State *) global.vm_state;
-  int result = 0;
-  char fname[64];
+    lua_State *L = (lua_State *)global.vm_state;
+    int result = 0;
+    char fname[64];
 
-  strlcpy(fname, "use_", sizeof(fname));
-  strlcat(fname, itype->rtype->_name, sizeof(fname));
+    strlcpy(fname, "use_", sizeof(fname));
+    strlcat(fname, itype->rtype->_name, sizeof(fname));
 
-  lua_getglobal(L, fname);
-  if (lua_isfunction(L, -1)) {
-    tolua_pushusertype(L, (void *)u, TOLUA_CAST "unit");
-    tolua_pushnumber(L, (lua_Number) amount);
+    lua_getglobal(L, fname);
+    if (lua_isfunction(L, -1)) {
+        tolua_pushusertype(L, (void *)u, TOLUA_CAST "unit");
+        tolua_pushnumber(L, (lua_Number)amount);
 
-    if (lua_pcall(L, 2, 1, 0) != 0) {
-      const char *error = lua_tostring(L, -1);
-      log_error("use(%s) calling '%s': %s.\n", unitname(u), fname, error);
-      lua_pop(L, 1);
-    } else {
-      result = (int)lua_tonumber(L, -1);
-      lua_pop(L, 1);
+        if (lua_pcall(L, 2, 1, 0) != 0) {
+            const char *error = lua_tostring(L, -1);
+            log_error("use(%s) calling '%s': %s.\n", unitname(u), fname, error);
+            lua_pop(L, 1);
+        }
+        else {
+            result = (int)lua_tonumber(L, -1);
+            lua_pop(L, 1);
+        }
+    }
+    else {
+        log_error("use(%s) calling '%s': not a function.\n", unitname(u), fname);
+        lua_pop(L, 1);
     }
-  } else {
-    log_error("use(%s) calling '%s': not a function.\n", unitname(u), fname);
-    lua_pop(L, 1);
-  }
 
-  return result;
+    return result;
 }
 
 int tolua_toid(lua_State * L, int idx, int def)
 {
-  int no = 0;
-  int type = lua_type(L, idx);
-  if (type == LUA_TNUMBER) {
-    no = (int)tolua_tonumber(L, idx, def);
-  } else {
-    const char *str = tolua_tostring(L, idx, NULL);
-    no = str ? atoi36(str) : def;
-  }
-  return no;
+    int no = 0;
+    int type = lua_type(L, idx);
+    if (type == LUA_TNUMBER) {
+        no = (int)tolua_tonumber(L, idx, def);
+    }
+    else {
+        const char *str = tolua_tostring(L, idx, NULL);
+        no = str ? atoi36(str) : def;
+    }
+    return no;
 }
 
 void register_tolua_helpers(void)
@@ -519,30 +547,30 @@ void register_tolua_helpers(void)
     at_register(&at_direction);
     at_register(&at_building_action);
 
-  register_function((pf_generic) & lua_building_taxes,
-    TOLUA_CAST "lua_building_taxes");
-  register_function((pf_generic) & lua_agebuilding,
-    TOLUA_CAST "lua_agebuilding");
-  register_function((pf_generic) & lua_callspell, TOLUA_CAST "lua_castspell");
-  register_function((pf_generic) & lua_initfamiliar,
-    TOLUA_CAST "lua_initfamiliar");
-  register_item_use(&lua_useitem, TOLUA_CAST "lua_useitem");
-  register_function((pf_generic) & lua_getresource,
-    TOLUA_CAST "lua_getresource");
-  register_function((pf_generic) & lua_canuse_item,
-    TOLUA_CAST "lua_canuse_item");
-  register_function((pf_generic) & lua_changeresource,
-    TOLUA_CAST "lua_changeresource");
-  register_function((pf_generic) & lua_equipmentcallback,
-    TOLUA_CAST "lua_equip");
+    register_function((pf_generic)& lua_building_taxes,
+        TOLUA_CAST "lua_building_taxes");
+    register_function((pf_generic)& lua_agebuilding,
+        TOLUA_CAST "lua_agebuilding");
+    register_function((pf_generic)& lua_callspell, TOLUA_CAST "lua_castspell");
+    register_function((pf_generic)& lua_initfamiliar,
+        TOLUA_CAST "lua_initfamiliar");
+    register_item_use(&lua_useitem, TOLUA_CAST "lua_useitem");
+    register_function((pf_generic)& lua_getresource,
+        TOLUA_CAST "lua_getresource");
+    register_function((pf_generic)& lua_canuse_item,
+        TOLUA_CAST "lua_canuse_item");
+    register_function((pf_generic)& lua_changeresource,
+        TOLUA_CAST "lua_changeresource");
+    register_function((pf_generic)& lua_equipmentcallback,
+        TOLUA_CAST "lua_equip");
 
-  register_function((pf_generic) & lua_wage, TOLUA_CAST "lua_wage");
-  register_function((pf_generic) & lua_maintenance,
-    TOLUA_CAST "lua_maintenance");
+    register_function((pf_generic)& lua_wage, TOLUA_CAST "lua_wage");
+    register_function((pf_generic)& lua_maintenance,
+        TOLUA_CAST "lua_maintenance");
 
-  register_function((pf_generic) produce_resource,
-    TOLUA_CAST "lua_produceresource");
-  register_function((pf_generic) limit_resource,
-    TOLUA_CAST "lua_limitresource");
-  register_item_give(lua_giveitem, TOLUA_CAST "lua_giveitem");
+    register_function((pf_generic)produce_resource,
+        TOLUA_CAST "lua_produceresource");
+    register_function((pf_generic)limit_resource,
+        TOLUA_CAST "lua_limitresource");
+    register_item_give(lua_giveitem, TOLUA_CAST "lua_giveitem");
 }
diff --git a/src/helpers.h b/src/helpers.h
index acf0d0d73..d77765187 100644
--- a/src/helpers.h
+++ b/src/helpers.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
 +-------------------+
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Christian Schlittchen <corwin@amber.kn-bremen.de>
diff --git a/src/items.c b/src/items.c
index 012dc9f7c..d7c9efd5e 100644
--- a/src/items.c
+++ b/src/items.c
@@ -48,7 +48,7 @@ struct order *ord)
         if (sv && sv->level > 2) {
             /* TODO: message */
         }
-        else if (sk!=NOSKILL && study_cost(u, sk) > 0) {
+        else if (sk != NOSKILL && study_cost(u, sk) > 0) {
             /* TODO: message */
         }
         else {
diff --git a/src/items.h b/src/items.h
index 5de50e512..2b839563d 100644
--- a/src/items.h
+++ b/src/items.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
 +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -6,7 +6,7 @@
 |                   |  Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
 +-------------------+  Stefan Reich <reich@halbling.de>
 
-This program may not be used, modified or distributed 
+This program may not be used, modified or distributed
 without prior permission by the authors of Eressea.
 */
 
@@ -16,7 +16,7 @@ without prior permission by the authors of Eressea.
 extern "C" {
 #endif
 
-  extern void register_itemfunctions(void);
+    extern void register_itemfunctions(void);
 
 #ifdef __cplusplus
 }
diff --git a/src/items/artrewards.c b/src/items/artrewards.c
index d25cba68d..5fee0940d 100644
--- a/src/items/artrewards.c
+++ b/src/items/artrewards.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -47,108 +47,110 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 static int age_peaceimmune(attrib * a)
 {
-  return (--a->data.i > 0) ? AT_AGE_KEEP : AT_AGE_REMOVE;
+    return (--a->data.i > 0) ? AT_AGE_KEEP : AT_AGE_REMOVE;
 }
 
 static attrib_type at_peaceimmune = {
-  "peaceimmune",
-  NULL, NULL,
-  age_peaceimmune,
-  a_writeint,
-  a_readint
+    "peaceimmune",
+    NULL, NULL,
+    age_peaceimmune,
+    a_writeint,
+    a_readint
 };
 
 static int
 use_hornofdancing(struct unit *u, const struct item_type *itype,
-  int amount, struct order *ord)
+int amount, struct order *ord)
 {
-  region *r;
-  int regionsPacified = 0;
+    region *r;
+    int regionsPacified = 0;
 
-  for (r = regions; r; r = r->next) {
-    if (distance(u->region, r) < HORNRANGE) {
-      if (a_find(r->attribs, &at_peaceimmune) == NULL) {
-        attrib *a;
+    for (r = regions; r; r = r->next) {
+        if (distance(u->region, r) < HORNRANGE) {
+            if (a_find(r->attribs, &at_peaceimmune) == NULL) {
+                attrib *a;
 
-        create_curse(u, &r->attribs, ct_find("peacezone"),
-          20, HORNDURATION, 1.0, 0);
+                create_curse(u, &r->attribs, ct_find("peacezone"),
+                    20, HORNDURATION, 1.0, 0);
 
-        a = a_add(&r->attribs, a_new(&at_peaceimmune));
-        a->data.i = HORNIMMUNITY;
+                a = a_add(&r->attribs, a_new(&at_peaceimmune));
+                a->data.i = HORNIMMUNITY;
 
-        ADDMSG(&r->msgs, msg_message("hornofpeace_r_success",
-            "unit region", u, u->region));
+                ADDMSG(&r->msgs, msg_message("hornofpeace_r_success",
+                    "unit region", u, u->region));
 
-        regionsPacified++;
-      } else {
-        ADDMSG(&r->msgs, msg_message("hornofpeace_r_nosuccess",
-            "unit region", u, u->region));
-      }
+                regionsPacified++;
+            }
+            else {
+                ADDMSG(&r->msgs, msg_message("hornofpeace_r_nosuccess",
+                    "unit region", u, u->region));
+            }
+        }
     }
-  }
 
-  if (regionsPacified > 0) {
-    ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "hornofpeace_u_success",
-        "pacified", regionsPacified));
-  } else {
-    ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "hornofpeace_u_nosuccess",
-        ""));
-  }
+    if (regionsPacified > 0) {
+        ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "hornofpeace_u_success",
+            "pacified", regionsPacified));
+    }
+    else {
+        ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "hornofpeace_u_nosuccess",
+            ""));
+    }
 
-  return 0;
+    return 0;
 }
 
 #define SPEEDUP 2
 
 static int
 useonother_trappedairelemental(struct unit *u, int shipId,
-  const struct item_type *itype, int amount, struct order *ord)
+const struct item_type *itype, int amount, struct order *ord)
 {
-  curse *c;
-  ship *sh;
+    curse *c;
+    ship *sh;
 
-  if (shipId <= 0) {
-    cmistake(u, ord, 20, MSG_MOVE);
-    return -1;
-  }
+    if (shipId <= 0) {
+        cmistake(u, ord, 20, MSG_MOVE);
+        return -1;
+    }
 
-  sh = findshipr(u->region, shipId);
-  if (!sh) {
-    cmistake(u, ord, 20, MSG_MOVE);
-    return -1;
-  }
+    sh = findshipr(u->region, shipId);
+    if (!sh) {
+        cmistake(u, ord, 20, MSG_MOVE);
+        return -1;
+    }
 
-  c =
-    create_curse(u, &sh->attribs, ct_find("shipspeedup"), 20, INT_MAX, SPEEDUP,
-    0);
-  c_setflag(c, CURSE_NOAGE);
+    c =
+        create_curse(u, &sh->attribs, ct_find("shipspeedup"), 20, INT_MAX, SPEEDUP,
+        0);
+    c_setflag(c, CURSE_NOAGE);
 
-  ADDMSG(&u->faction->msgs, msg_message("trappedairelemental_success",
-      "unit region command ship", u, u->region, ord, sh));
+    ADDMSG(&u->faction->msgs, msg_message("trappedairelemental_success",
+        "unit region command ship", u, u->region, ord, sh));
 
-  use_pooled(u, itype->rtype, GET_DEFAULT, 1);
+    use_pooled(u, itype->rtype, GET_DEFAULT, 1);
 
-  return 0;
+    return 0;
 }
 
 static int
 use_trappedairelemental(struct unit *u,
-  const struct item_type *itype, int amount, struct order *ord)
+const struct item_type *itype, int amount, struct order *ord)
 {
-  ship *sh = u->ship;
+    ship *sh = u->ship;
 
-  if (sh == NULL) {
-    cmistake(u, ord, 20, MSG_MOVE);
-    return -1;
-  }
-  return useonother_trappedairelemental(u, sh->no, itype, amount, ord);
+    if (sh == NULL) {
+        cmistake(u, ord, 20, MSG_MOVE);
+        return -1;
+    }
+    return useonother_trappedairelemental(u, sh->no, itype, amount, ord);
 }
 
 void register_artrewards(void)
 {
-  at_register(&at_peaceimmune);
-  register_item_use(use_hornofdancing, "use_hornofdancing");
-  register_item_use(use_trappedairelemental, "use_trappedairelemental");
-  register_item_useonother(useonother_trappedairelemental,
-    "useonother_trappedairelemental");
+    at_register(&at_peaceimmune);
+    register_item_use(use_hornofdancing, "use_hornofdancing");
+    register_item_use(use_trappedairelemental, "use_trappedairelemental");
+    register_item_useonother(useonother_trappedairelemental,
+        "useonother_trappedairelemental");
 }
diff --git a/src/items/artrewards.h b/src/items/artrewards.h
index 4141c9331..6b1d05210 100644
--- a/src/items/artrewards.h
+++ b/src/items/artrewards.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,7 +22,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  extern void register_artrewards(void);
+    extern void register_artrewards(void);
 
 #ifdef __cplusplus
 }
diff --git a/src/items/demonseye.c b/src/items/demonseye.c
index 2084da4de..64a753e45 100644
--- a/src/items/demonseye.c
+++ b/src/items/demonseye.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -36,30 +36,31 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 static int
 summon_igjarjuk(struct unit *u, const struct item_type *itype, int amount,
-  struct order *ord)
+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;
-  }
+    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;
+    }
 }
 
 static int
 give_igjarjuk(struct unit *src, struct unit *d, const struct item_type *itype,
-  int n, struct order *ord)
+int n, struct order *ord)
 {
-  ADDMSG(&src->faction->msgs, msg_feedback(src, ord, "error_giveeye", ""));
-  return 0;
+    ADDMSG(&src->faction->msgs, msg_feedback(src, ord, "error_giveeye", ""));
+    return 0;
 }
 
 void register_demonseye(void)
 {
-  register_item_use(summon_igjarjuk, "useigjarjuk");
-  register_item_give(give_igjarjuk, "giveigjarjuk");
+    register_item_use(summon_igjarjuk, "useigjarjuk");
+    register_item_give(give_igjarjuk, "giveigjarjuk");
 }
diff --git a/src/items/demonseye.h b/src/items/demonseye.h
index 155eac8c6..36eda43ac 100644
--- a/src/items/demonseye.h
+++ b/src/items/demonseye.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,7 +22,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  extern void register_demonseye(void);
+    void register_demonseye(void);
 
 #ifdef __cplusplus
 }
diff --git a/src/items/itemtypes.c b/src/items/itemtypes.c
index eb72449ea..4c154efdb 100644
--- a/src/items/itemtypes.c
+++ b/src/items/itemtypes.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/*
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -6,9 +6,9 @@
  |                   |  Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
  +-------------------+  Stefan Reich <reich@halbling.de>
 
- This program may not be used, modified or distributed 
+ This program may not be used, modified or distributed
  without prior permission by the authors of Eressea.
-*/
+ */
 
 #include <platform.h>
 #include <kernel/config.h>
@@ -22,15 +22,15 @@
 
 void register_itemtypes(void)
 {
-  /* registering misc. functions */
-  register_weapons();
-  register_xerewards();
-  register_artrewards();
-  register_phoenixcompass();
+    /* registering misc. functions */
+    register_weapons();
+    register_xerewards();
+    register_artrewards();
+    register_phoenixcompass();
 }
 
 void init_itemtypes(void)
 {
-  init_seed();
-  init_mallornseed();
+    init_seed();
+    init_mallornseed();
 }
diff --git a/src/items/itemtypes.h b/src/items/itemtypes.h
index f1a70a705..ec705c55b 100644
--- a/src/items/itemtypes.h
+++ b/src/items/itemtypes.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/*
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -6,9 +6,9 @@
  |                   |  Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
  +-------------------+  Stefan Reich <reich@halbling.de>
 
- This program may not be used, modified or distributed 
+ This program may not be used, modified or distributed
  without prior permission by the authors of Eressea.
-*/
+ */
 
 #ifndef H_ITM_ITEMS
 #define H_ITM_ITEMS
@@ -16,8 +16,8 @@
 extern "C" {
 #endif
 
-  extern void init_itemtypes(void);
-  extern void register_itemtypes(void);
+    extern void init_itemtypes(void);
+    extern void register_itemtypes(void);
 
 #ifdef __cplusplus
 }
diff --git a/src/items/phoenixcompass.c b/src/items/phoenixcompass.c
index dcec08cdd..f16e5ea79 100644
--- a/src/items/phoenixcompass.c
+++ b/src/items/phoenixcompass.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -40,89 +40,92 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 static int
 use_phoenixcompass(struct unit *u, const struct item_type *itype,
-  int amount, struct order *ord)
+int amount, struct order *ord)
 {
-  region *r;
-  unit *closest_phoenix = NULL;
-  int closest_phoenix_distance = INT_MAX;
-  bool confusion = false;
-  direction_t direction;
-  unit *u2;
-  direction_t closest_neighbour_direction = 0;
-  static const race *rc_phoenix = NULL;
+    region *r;
+    unit *closest_phoenix = NULL;
+    int closest_phoenix_distance = INT_MAX;
+    bool confusion = false;
+    direction_t direction;
+    unit *u2;
+    direction_t closest_neighbour_direction = 0;
+    static const race *rc_phoenix = NULL;
 
-  if (rc_phoenix == NULL) {
-    rc_phoenix = rc_find("phoenix");
-    if (rc_phoenix == NULL)
-      return 0;
-  }
+    if (rc_phoenix == NULL) {
+        rc_phoenix = rc_find("phoenix");
+        if (rc_phoenix == NULL)
+            return 0;
+    }
 
-  /* find the closest phoenix. */
+    /* find the closest phoenix. */
 
-  for (r = regions; r; r = r->next) {
-    for (u2 = r->units; u2; u2 = u2->next) {
-      if (u_race(u2) == rc_phoenix) {
-        if (closest_phoenix == NULL) {
-          closest_phoenix = u2;
-          closest_phoenix_distance =
-            distance(u->region, closest_phoenix->region);
-        } else {
-          int dist = distance(u->region, r);
-          if (dist < closest_phoenix_distance) {
-            closest_phoenix = u2;
-            closest_phoenix_distance = dist;
-            confusion = false;
-          } else if (dist == closest_phoenix_distance) {
-            confusion = true;
-          }
+    for (r = regions; r; r = r->next) {
+        for (u2 = r->units; u2; u2 = u2->next) {
+            if (u_race(u2) == rc_phoenix) {
+                if (closest_phoenix == NULL) {
+                    closest_phoenix = u2;
+                    closest_phoenix_distance =
+                        distance(u->region, closest_phoenix->region);
+                }
+                else {
+                    int dist = distance(u->region, r);
+                    if (dist < closest_phoenix_distance) {
+                        closest_phoenix = u2;
+                        closest_phoenix_distance = dist;
+                        confusion = false;
+                    }
+                    else if (dist == closest_phoenix_distance) {
+                        confusion = true;
+                    }
+                }
+            }
         }
-      }
     }
-  }
 
-  /* no phoenix found at all.* if confusion == true more than one phoenix
-   * at the same distance was found and the device is confused */
+    /* no phoenix found at all.* if confusion == true more than one phoenix
+     * at the same distance was found and the device is confused */
+
+    if (closest_phoenix == NULL
+        || closest_phoenix->region == u->region || confusion) {
+        add_message(&u->faction->msgs, msg_message("phoenixcompass_confusion",
+            "unit region command", u, u->region, ord));
+        return 0;
+    }
+
+    /* else calculate the direction. this is tricky. we calculate the
+     * neighbouring region which is closest to the phoenix found. hardcoded
+     * for readability. */
+
+    for (direction = 0; direction < MAXDIRECTIONS; ++direction) {
+        region *neighbour;
+        int closest_neighbour_distance = INT_MAX;
+
+        neighbour = r_connect(u->region, direction);
+        if (neighbour != NULL) {
+            int dist = distance(neighbour, closest_phoenix->region);
+            if (dist < closest_neighbour_distance) {
+                closest_neighbour_direction = direction;
+                closest_neighbour_distance = dist;
+            }
+            else if (dist == closest_neighbour_distance && rng_int() % 100 < 50) {
+                /* there can never be more than two neighbours with the same
+                 * distance (except when you are standing in the same region
+                 * as the phoenix, but that case has already been handled).
+                 * therefore this simple solution is correct */
+                closest_neighbour_direction = direction;
+                closest_neighbour_distance = dist;
+            }
+        }
+    }
+
+    add_message(&u->faction->msgs, msg_message("phoenixcompass_success",
+        "unit region command dir",
+        u, u->region, ord, closest_neighbour_direction));
 
-  if (closest_phoenix == NULL
-    || closest_phoenix->region == u->region || confusion) {
-    add_message(&u->faction->msgs, msg_message("phoenixcompass_confusion",
-        "unit region command", u, u->region, ord));
     return 0;
-  }
-
-  /* else calculate the direction. this is tricky. we calculate the
-   * neighbouring region which is closest to the phoenix found. hardcoded
-   * for readability. */
-
-  for (direction = 0; direction < MAXDIRECTIONS; ++direction) {
-    region *neighbour;
-    int closest_neighbour_distance = INT_MAX;
-
-    neighbour = r_connect(u->region, direction);
-    if (neighbour != NULL) {
-      int dist = distance(neighbour, closest_phoenix->region);
-      if (dist < closest_neighbour_distance) {
-        closest_neighbour_direction = direction;
-        closest_neighbour_distance = dist;
-      } else if (dist == closest_neighbour_distance && rng_int() % 100 < 50) {
-        /* there can never be more than two neighbours with the same
-         * distance (except when you are standing in the same region
-         * as the phoenix, but that case has already been handled).
-         * therefore this simple solution is correct */
-        closest_neighbour_direction = direction;
-        closest_neighbour_distance = dist;
-      }
-    }
-  }
-
-  add_message(&u->faction->msgs, msg_message("phoenixcompass_success",
-      "unit region command dir",
-      u, u->region, ord, closest_neighbour_direction));
-
-  return 0;
 }
 
 void register_phoenixcompass(void)
 {
-  register_item_use(use_phoenixcompass, "use_phoenixcompass");
+    register_item_use(use_phoenixcompass, "use_phoenixcompass");
 }
diff --git a/src/items/phoenixcompass.h b/src/items/phoenixcompass.h
index 7bb03ba62..d34ec315b 100644
--- a/src/items/phoenixcompass.h
+++ b/src/items/phoenixcompass.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,7 +22,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  extern void register_phoenixcompass(void);
+    extern void register_phoenixcompass(void);
 
 #ifdef __cplusplus
 }
diff --git a/src/items/seed.c b/src/items/seed.c
index 5f60709d2..ae55c0225 100644
--- a/src/items/seed.c
+++ b/src/items/seed.c
@@ -1,14 +1,20 @@
-/* vi: set ts=2:
- +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
- |                   |  Enno Rehling <enno@eressea.de>
- | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
- | (c) 1998 - 2003   |  Henning Peters <faroul@beyond.kn-bremen.de>
- |                   |  Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
- +-------------------+  Stefan Reich <reich@halbling.de>
+/*
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
- This program may not be used, modified or distributed 
- without prior permission by the authors of Eressea.
-*/
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+**/
 
 #include <platform.h>
 #include <kernel/config.h>
@@ -47,11 +53,11 @@ void init_seed(void)
     attrib *a;
     resource_limit *rdata;
     resource_type *rtype;
-  
+
     rtype = rt_find("seed");
     if (rtype != NULL) {
         a = a_add(&rtype->attribs, a_new(&at_resourcelimit));
-        rdata = (resource_limit *) a->data.v;
+        rdata = (resource_limit *)a->data.v;
         rdata->limit = limit_seeds;
         rdata->produce = produce_seeds;
     }
@@ -62,16 +68,16 @@ void init_seed(void)
 static void
 produce_mallornseeds(region * r, const resource_type * rtype, int norders)
 {
-  assert(fval(r, RF_MALLORN));
-  r->land->trees[0] -= norders;
+    assert(fval(r, RF_MALLORN));
+    r->land->trees[0] -= norders;
 }
 
 static int limit_mallornseeds(const region * r, const resource_type * rtype)
 {
-  if (!fval(r, RF_MALLORN)) {
-    return 0;
-  }
-  return r->land ? r->land->trees[0] : 0;
+    if (!fval(r, RF_MALLORN)) {
+        return 0;
+    }
+    return r->land ? r->land->trees[0] : 0;
 }
 
 void init_mallornseed(void)
@@ -84,9 +90,9 @@ void init_mallornseed(void)
     if (rtype != NULL) {
         rtype->flags |= RTF_LIMITED;
         rtype->flags |= RTF_POOLED;
-        
+
         a = a_add(&rtype->attribs, a_new(&at_resourcelimit));
-        rdata = (resource_limit *) a->data.v;
+        rdata = (resource_limit *)a->data.v;
         rdata->limit = limit_mallornseeds;
         rdata->produce = produce_mallornseeds;
     }
diff --git a/src/items/seed.h b/src/items/seed.h
index f789b1f6e..cd58f4c95 100644
--- a/src/items/seed.h
+++ b/src/items/seed.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,8 +22,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  extern void init_seed(void);
-  extern void init_mallornseed(void);
+    extern void init_seed(void);
+    extern void init_mallornseed(void);
 
 #ifdef __cplusplus
 }
diff --git a/src/items/speedsail.c b/src/items/speedsail.c
index 5ae691b64..db8f17ca4 100644
--- a/src/items/speedsail.c
+++ b/src/items/speedsail.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -40,35 +40,38 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 static int
 use_speedsail(struct unit *u, const struct item_type *itype, int amount,
-  struct order *ord)
+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);
+    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 {
+        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;
 }
 
 void register_speedsail(void)
 {
-  register_item_use(use_speedsail, "use_speedsail");
+    register_item_use(use_speedsail, "use_speedsail");
 }
diff --git a/src/items/speedsail.h b/src/items/speedsail.h
index 45440f358..9ca8dc4f3 100644
--- a/src/items/speedsail.h
+++ b/src/items/speedsail.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,7 +22,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  extern void register_speedsail(void);
+    extern void register_speedsail(void);
 
 #ifdef __cplusplus
 }
diff --git a/src/items/weapons.c b/src/items/weapons.c
index a7114d321..f6563eafa 100644
--- a/src/items/weapons.c
+++ b/src/items/weapons.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -40,53 +40,53 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 static bool
 attack_firesword(const troop * at, const struct weapon_type *wtype,
-  int *casualties)
+int *casualties)
 {
-  fighter *fi = at->fighter;
-  troop dt;
-  int killed = 0;
-  const char *damage = "2d8";
-  int force = 1 + rng_int() % 10;
-  int enemies =
-    count_enemies(fi->side->battle, fi, 0, 1, SELECT_ADVANCE | SELECT_DISTANCE);
+    fighter *fi = at->fighter;
+    troop dt;
+    int killed = 0;
+    const char *damage = "2d8";
+    int force = 1 + rng_int() % 10;
+    int enemies =
+        count_enemies(fi->side->battle, fi, 0, 1, SELECT_ADVANCE | SELECT_DISTANCE);
 
-  if (!enemies) {
+    if (!enemies) {
+        if (casualties)
+            *casualties = 0;
+        return true;                /* if no enemy found, no use doing standarad attack */
+    }
+
+    if (fi->catmsg == -1) {
+        int i, k = 0;
+        message *msg;
+        for (i = 0; i <= at->index; ++i) {
+            struct weapon *wp = fi->person[i].melee;
+            if (wp != NULL && wp->type == wtype)
+                ++k;
+        }
+        msg = msg_message("battle::useflamingsword", "amount unit", k, fi->unit);
+        message_all(fi->side->battle, msg);
+        msg_release(msg);
+        fi->catmsg = 0;
+    }
+
+    do {
+        dt = select_enemy(fi, 0, 1, SELECT_ADVANCE | SELECT_DISTANCE);
+        --force;
+        if (dt.fighter) {
+            killed += terminate(dt, *at, AT_SPELL, damage, 1);
+        }
+    } while (force && killed < enemies);
     if (casualties)
-      *casualties = 0;
-    return true;                /* if no enemy found, no use doing standarad attack */
-  }
-
-  if (fi->catmsg == -1) {
-    int i, k = 0;
-    message *msg;
-    for (i = 0; i <= at->index; ++i) {
-      struct weapon *wp = fi->person[i].melee;
-      if (wp != NULL && wp->type == wtype)
-        ++k;
-    }
-    msg = msg_message("battle::useflamingsword", "amount unit", k, fi->unit);
-    message_all(fi->side->battle, msg);
-    msg_release(msg);
-    fi->catmsg = 0;
-  }
-
-  do {
-    dt = select_enemy(fi, 0, 1, SELECT_ADVANCE | SELECT_DISTANCE);
-    --force;
-    if (dt.fighter) {
-      killed += terminate(dt, *at, AT_SPELL, damage, 1);
-    }
-  } while (force && killed < enemies);
-  if (casualties)
-    *casualties = killed;
-  return true;
+        *casualties = killed;
+    return true;
 }
 
 #define CATAPULT_ATTACKS 6
 
 static bool
 attack_catapult(const troop * at, const struct weapon_type *wtype,
-  int *casualties)
+int *casualties)
 {
     fighter *af = at->fighter;
     unit *au = af->unit;
@@ -98,9 +98,9 @@ attack_catapult(const troop * at, const struct weapon_type *wtype,
 
     assert(wp->type == wtype);
     assert(af->person[at->index].reload == 0);
-    
+
     if (rtype) {
-        if (get_pooled(au, rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, 1) <= 0) {
+        if (get_pooled(au, rtype, GET_SLACK | GET_RESERVE | GET_POOLED_SLACK, 1) <= 0) {
             /* No ammo. Use other weapon if available. */
             return true;
         }
@@ -111,11 +111,11 @@ attack_catapult(const troop * at, const struct weapon_type *wtype,
     if (enemies == 0) {
         return true;                /* allow further attacks */
     }
-    
+
     if (af->catmsg == -1) {
         int i, k = 0;
         message *msg;
-        
+
         for (i = 0; i <= at->index; ++i) {
             if (af->person[i].reload == 0 && af->person[i].missile == wp)
                 ++k;
@@ -125,17 +125,17 @@ attack_catapult(const troop * at, const struct weapon_type *wtype,
         msg_release(msg);
         af->catmsg = 0;
     }
-    
+
     if (rtype) {
-        use_pooled(au, rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, 1);
+        use_pooled(au, rtype, GET_SLACK | GET_RESERVE | GET_POOLED_SLACK, 1);
     }
-    
+
     while (--enemies >= 0) {
         /* Select defender */
         dt = select_enemy(af, FIGHT_ROW, FIGHT_ROW, SELECT_ADVANCE);
         if (!dt.fighter)
             break;
-        
+
         /* If battle succeeds */
         if (hits(*at, dt, wp)) {
             d += terminate(dt, *at, AT_STANDARD, wp->type->damage[0], true);
@@ -144,7 +144,8 @@ attack_catapult(const troop * at, const struct weapon_type *wtype,
                 float dmg =
                     get_param_flt(global.parameters, "rules.building.damage.catapult", 1);
                 damage_building(b, dt.fighter->unit->building, dmg);
-            } else if (dt.fighter->unit->ship && rng_int() % 100 < 5) {
+            }
+            else if (dt.fighter->unit->ship && rng_int() % 100 < 5) {
                 float dmg =
                     get_param_flt(global.parameters, "rules.ship.damage.catapult", 0.01);
                 damage_ship(dt.fighter->unit->ship, dmg)
@@ -152,7 +153,7 @@ attack_catapult(const troop * at, const struct weapon_type *wtype,
 #endif
         }
     }
-    
+
     if (casualties) {
         *casualties = d;
     }
@@ -161,6 +162,6 @@ attack_catapult(const troop * at, const struct weapon_type *wtype,
 
 void register_weapons(void)
 {
-  register_function((pf_generic) attack_catapult, "attack_catapult");
-  register_function((pf_generic) attack_firesword, "attack_firesword");
+    register_function((pf_generic)attack_catapult, "attack_catapult");
+    register_function((pf_generic)attack_firesword, "attack_firesword");
 }
diff --git a/src/items/weapons.h b/src/items/weapons.h
index d63bbd6ee..a14662e6c 100644
--- a/src/items/weapons.h
+++ b/src/items/weapons.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
diff --git a/src/items/xerewards.c b/src/items/xerewards.c
index a0ade546a..4eea6d20f 100644
--- a/src/items/xerewards.c
+++ b/src/items/xerewards.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -41,53 +41,53 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 static int
 use_skillpotion(struct unit *u, const struct item_type *itype, int amount,
-  struct order *ord)
+struct order *ord)
 {
-  /* the problem with making this a lua function is that there's no way
-   * to get the list of skills for a unit. and with the way skills are 
-   * currently saved, it doesn't look likely (can't make eressea::list 
-   * from them)
-   */
-  int n;
-  for (n = 0; n != amount; ++n) {
-    skill *sv = u->skills;
-    while (sv != u->skills + u->skill_size) {
-      int i;
-      for (i = 0; i != 3; ++i)
-        learn_skill(u, (skill_t)sv->id, 1.0);
-      ++sv;
+    /* the problem with making this a lua function is that there's no way
+     * to get the list of skills for a unit. and with the way skills are
+     * currently saved, it doesn't look likely (can't make eressea::list
+     * from them)
+     */
+    int n;
+    for (n = 0; n != amount; ++n) {
+        skill *sv = u->skills;
+        while (sv != u->skills + u->skill_size) {
+            int i;
+            for (i = 0; i != 3; ++i)
+                learn_skill(u, (skill_t)sv->id, 1.0);
+            ++sv;
+        }
     }
-  }
-  ADDMSG(&u->faction->msgs, msg_message("skillpotion_use", "unit", u));
+    ADDMSG(&u->faction->msgs, msg_message("skillpotion_use", "unit", u));
 
-  change_resource(u, itype->rtype, -amount);
-  return 0;
+    change_resource(u, itype->rtype, -amount);
+    return 0;
 }
 
 static int
 use_manacrystal(struct unit *u, const struct item_type *itype, int amount,
-  struct order *ord)
+struct order *ord)
 {
-  int i, sp = 0;
+    int i, sp = 0;
 
-  if (!is_mage(u)) {
-    cmistake(u, u->thisorder, 295, MSG_EVENT);
-    return -1;
-  }
+    if (!is_mage(u)) {
+        cmistake(u, u->thisorder, 295, MSG_EVENT);
+        return -1;
+    }
 
-  for (i = 0; i != amount; ++i) {
-    sp += _max(25, max_spellpoints(u->region, u) / 2);
-    change_spellpoints(u, sp);
-  }
+    for (i = 0; i != amount; ++i) {
+        sp += _max(25, max_spellpoints(u->region, u) / 2);
+        change_spellpoints(u, sp);
+    }
 
-  ADDMSG(&u->faction->msgs, msg_message("manacrystal_use", "unit aura", u, sp));
+    ADDMSG(&u->faction->msgs, msg_message("manacrystal_use", "unit aura", u, sp));
 
-  change_resource(u, itype->rtype, -amount);
-  return 0;
+    change_resource(u, itype->rtype, -amount);
+    return 0;
 }
 
 void register_xerewards(void)
 {
-  register_item_use(use_skillpotion, "use_skillpotion");
-  register_item_use(use_manacrystal, "use_manacrystal");
+    register_item_use(use_skillpotion, "use_skillpotion");
+    register_item_use(use_manacrystal, "use_manacrystal");
 }
diff --git a/src/items/xerewards.h b/src/items/xerewards.h
index 8fa8b3859..85da435ac 100644
--- a/src/items/xerewards.h
+++ b/src/items/xerewards.h
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
                          Katja Zedel <katze@felidae.kn-bremen.de
                          Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/json.c b/src/json.c
index ec0c4febf..47a7a02cf 100644
--- a/src/json.c
+++ b/src/json.c
@@ -29,7 +29,7 @@ int json_import(struct stream * out) {
     }
     json = cJSON_Parse(data);
     child = cJSON_GetObjectItem(json, "regions");
-    if (child && child->type==cJSON_Object) {
+    if (child && child->type == cJSON_Object) {
         cJSON *j;
         for (j = child->child; j; j = j->next) {
             cJSON *attr;
@@ -62,15 +62,15 @@ int json_export(stream * out, int flags) {
         region * r;
         plane * p;
         cJSON_AddItemToObject(root, "planes", json = cJSON_CreateObject());
-        for (p=planes;p;p=p->next) {
-           cJSON *data;
-           _snprintf(id, sizeof(id), "%u", p->id);
-           cJSON_AddItemToObject(json, id, data = cJSON_CreateObject());
-           cJSON_AddNumberToObject(data, "x", p->minx);
-           cJSON_AddNumberToObject(data, "y", p->miny);
-           cJSON_AddNumberToObject(data, "width", p->maxx-p->minx);
-           cJSON_AddNumberToObject(data, "height", p->maxy-p->miny);
-           if (p->name) cJSON_AddStringToObject(data, "name", p->name);
+        for (p = planes; p; p = p->next) {
+            cJSON *data;
+            _snprintf(id, sizeof(id), "%u", p->id);
+            cJSON_AddItemToObject(json, id, data = cJSON_CreateObject());
+            cJSON_AddNumberToObject(data, "x", p->minx);
+            cJSON_AddNumberToObject(data, "y", p->miny);
+            cJSON_AddNumberToObject(data, "width", p->maxx - p->minx);
+            cJSON_AddNumberToObject(data, "height", p->maxy - p->miny);
+            if (p->name) cJSON_AddStringToObject(data, "name", p->name);
         }
 
         cJSON_AddItemToObject(root, "regions", json = cJSON_CreateObject());
diff --git a/src/json.test.c b/src/json.test.c
index 53e7cf336..146278cc7 100644
--- a/src/json.test.c
+++ b/src/json.test.c
@@ -20,7 +20,7 @@ static char *strip(char *str) {
     for (; *b && isspace(*b); ++b) {};
     for (e = b; *e && !isspace(*e); ++e) {};
     while (*b) {
-        if (s!=b) {
+        if (s != b) {
             memcpy(s, b, e - b);
         }
         s += e - b;
@@ -119,7 +119,7 @@ static void test_export_no_factions(CuTest * tc) {
     CuAssertIntEquals(tc, 0, err);
     out.api->rewind(out.handle);
     len = out.api->read(out.handle, buf, sizeof(buf));
-    buf[len]=0;
+    buf[len] = 0;
     CuAssertStrEquals(tc, "{}", strip(buf));
     mstream_done(&out);
     test_cleanup();
diff --git a/src/kernel/alliance.c b/src/kernel/alliance.c
index 10fa851c7..76f37edce 100644
--- a/src/kernel/alliance.c
+++ b/src/kernel/alliance.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/*
 +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -58,465 +58,472 @@ void free_alliances(void)
 
 alliance *makealliance(int id, const char *name)
 {
-  alliance *al;;
+    alliance *al;;
 
-  for (;;) {
-    if (id > 0) {
-      for (al = alliances; al; al = al->next) {
-        if (al->id == id) {
-          id = 0;
-          break;
+    for (;;) {
+        if (id > 0) {
+            for (al = alliances; al; al = al->next) {
+                if (al->id == id) {
+                    id = 0;
+                    break;
+                }
+            }
+            if (id > 0)
+                break;
         }
-      }
-      if (id > 0)
-        break;
+        id = id ? id : (1 + (rng_int() % MAX_UNIT_NR));
     }
-    id = id ? id : (1 + (rng_int() % MAX_UNIT_NR));
-  }
-  al = calloc(1, sizeof(alliance));
-  al->id = id;
-  if (name) {
-    al->name = _strdup(name);
-  } else {
-    al->flags |= ALF_NON_ALLIED;
-  }
-  al->next = alliances;
-  return alliances = al;
+    al = calloc(1, sizeof(alliance));
+    al->id = id;
+    if (name) {
+        al->name = _strdup(name);
+    }
+    else {
+        al->flags |= ALF_NON_ALLIED;
+    }
+    al->next = alliances;
+    return alliances = al;
 }
 
 alliance *findalliance(int id)
 {
-  alliance *al;
-  for (al = alliances; al; al = al->next) {
-    if (al->id == id)
-      return al;
-  }
-  return NULL;
+    alliance *al;
+    for (al = alliances; al; al = al->next) {
+        if (al->id == id)
+            return al;
+    }
+    return NULL;
 }
 
 typedef struct alliance_transaction {
-  struct alliance_transaction *next;
-  unit *u;
-  order *ord;
-/*    alliance * al; */
-/*    variant userdata; */
+    struct alliance_transaction *next;
+    unit *u;
+    order *ord;
+    /*    alliance * al; */
+    /*    variant userdata; */
 } alliance_transaction;
 
 static struct alliance_transaction *transactions[ALLIANCE_MAX];
 
 faction *alliance_get_leader(alliance * al)
 {
-  if (!al->_leader) {
-    if (al->members) {
-      al->_leader = (faction *) ql_get(al->members, 0);
+    if (!al->_leader) {
+        if (al->members) {
+            al->_leader = (faction *)ql_get(al->members, 0);
+        }
     }
-  }
-  return al->_leader;
+    return al->_leader;
 }
 
 static void create_transaction(int type, unit * u, order * ord)
 {
-  alliance_transaction *tr =
-    (alliance_transaction *) calloc(1, sizeof(alliance_transaction));
-  tr->ord = ord;
-  tr->u = u;
-  tr->next = transactions[type];
-  transactions[type] = tr;
+    alliance_transaction *tr =
+        (alliance_transaction *)calloc(1, sizeof(alliance_transaction));
+    tr->ord = ord;
+    tr->u = u;
+    tr->next = transactions[type];
+    transactions[type] = tr;
 }
 
 static void cmd_kick(const void *tnext, struct unit *u, struct order *ord)
 {
-  create_transaction(ALLIANCE_KICK, u, ord);
+    create_transaction(ALLIANCE_KICK, u, ord);
 }
 
 static void cmd_leave(const void *tnext, struct unit *u, struct order *ord)
 {
-  create_transaction(ALLIANCE_LEAVE, u, ord);
+    create_transaction(ALLIANCE_LEAVE, u, ord);
 }
 
 static void cmd_transfer(const void *tnext, struct unit *u, struct order *ord)
 {
-  create_transaction(ALLIANCE_TRANSFER, u, ord);
+    create_transaction(ALLIANCE_TRANSFER, u, ord);
 }
 
 static void cmd_new(const void *tnext, struct unit *u, struct order *ord)
 {
-  create_transaction(ALLIANCE_NEW, u, ord);
+    create_transaction(ALLIANCE_NEW, u, ord);
 }
 
 static void cmd_invite(const void *tnext, struct unit *u, struct order *ord)
 {
-  create_transaction(ALLIANCE_INVITE, u, ord);
+    create_transaction(ALLIANCE_INVITE, u, ord);
 }
 
 static void cmd_join(const void *tnext, struct unit *u, struct order *ord)
 {
-  create_transaction(ALLIANCE_JOIN, u, ord);
+    create_transaction(ALLIANCE_JOIN, u, ord);
 }
 
 static void perform_kick(void)
 {
-  alliance_transaction **tap = transactions + ALLIANCE_KICK;
-  while (*tap) {
-    alliance_transaction *ta = *tap;
-    alliance *al = f_get_alliance(ta->u->faction);
+    alliance_transaction **tap = transactions + ALLIANCE_KICK;
+    while (*tap) {
+        alliance_transaction *ta = *tap;
+        alliance *al = f_get_alliance(ta->u->faction);
 
-    if (al && alliance_get_leader(al) == ta->u->faction) {
-      faction *f;
-      init_order(ta->ord);
-      skip_token();
-      f = getfaction();
-      if (f && f_get_alliance(f) == al) {
-        setalliance(f, NULL);
-      }
+        if (al && alliance_get_leader(al) == ta->u->faction) {
+            faction *f;
+            init_order(ta->ord);
+            skip_token();
+            f = getfaction();
+            if (f && f_get_alliance(f) == al) {
+                setalliance(f, NULL);
+            }
+        }
+        *tap = ta->next;
+        free(ta);
     }
-    *tap = ta->next;
-    free(ta);
-  }
 }
 
 static void perform_new(void)
 {
-  alliance_transaction **tap = transactions + ALLIANCE_NEW;
-  while (*tap) {
-    alliance_transaction *ta = *tap;
-    alliance *al;
-    int id;
-    faction *f = ta->u->faction;
+    alliance_transaction **tap = transactions + ALLIANCE_NEW;
+    while (*tap) {
+        alliance_transaction *ta = *tap;
+        alliance *al;
+        int id;
+        faction *f = ta->u->faction;
 
-    init_order(ta->ord);
-    skip_token();
-    id = getid();
+        init_order(ta->ord);
+        skip_token();
+        id = getid();
 
-    al = makealliance(id, itoa36(id));
-    setalliance(f, al);
+        al = makealliance(id, itoa36(id));
+        setalliance(f, al);
 
-    *tap = ta->next;
-    free(ta);
-  }
+        *tap = ta->next;
+        free(ta);
+    }
 }
 
 static void perform_leave(void)
 {
-  alliance_transaction **tap = transactions + ALLIANCE_LEAVE;
-  while (*tap) {
-    alliance_transaction *ta = *tap;
-    faction *f = ta->u->faction;
+    alliance_transaction **tap = transactions + ALLIANCE_LEAVE;
+    while (*tap) {
+        alliance_transaction *ta = *tap;
+        faction *f = ta->u->faction;
 
-    setalliance(f, NULL);
+        setalliance(f, NULL);
 
-    *tap = ta->next;
-    free(ta);
-  }
+        *tap = ta->next;
+        free(ta);
+    }
 }
 
 static void perform_transfer(void)
 {
-  alliance_transaction **tap = transactions + ALLIANCE_TRANSFER;
-  while (*tap) {
-    alliance_transaction *ta = *tap;
-    alliance *al = f_get_alliance(ta->u->faction);
+    alliance_transaction **tap = transactions + ALLIANCE_TRANSFER;
+    while (*tap) {
+        alliance_transaction *ta = *tap;
+        alliance *al = f_get_alliance(ta->u->faction);
 
-    if (al && alliance_get_leader(al) == ta->u->faction) {
-      faction *f;
-      init_order(ta->ord);
-      skip_token();
-      f = getfaction();
-      if (f && f_get_alliance(f) == al) {
-        al->_leader = f;
-      }
+        if (al && alliance_get_leader(al) == ta->u->faction) {
+            faction *f;
+            init_order(ta->ord);
+            skip_token();
+            f = getfaction();
+            if (f && f_get_alliance(f) == al) {
+                al->_leader = f;
+            }
+        }
+        *tap = ta->next;
+        free(ta);
     }
-    *tap = ta->next;
-    free(ta);
-  }
 }
 
 static void perform_join(void)
 {
-  alliance_transaction **tap = transactions + ALLIANCE_JOIN;
-  while (*tap) {
-    alliance_transaction *ta = *tap;
-    faction *fj = ta->u->faction;
-    int aid;
+    alliance_transaction **tap = transactions + ALLIANCE_JOIN;
+    while (*tap) {
+        alliance_transaction *ta = *tap;
+        faction *fj = ta->u->faction;
+        int aid;
 
-    init_order(ta->ord);
-    skip_token();
-    aid = getid();
-    if (aid) {
-      alliance *al = findalliance(aid);
-      if (al && f_get_alliance(fj) != al) {
-        alliance_transaction **tip = transactions + ALLIANCE_INVITE;
-        alliance_transaction *ti = *tip;
-        while (ti) {
-          faction *fi = ti->u->faction;
-          if (fi && f_get_alliance(fi) == al) {
-            int fid;
-            init_order(ti->ord);
-            skip_token();
-            fid = getid();
-            if (fid == fj->no) {
-              break;
+        init_order(ta->ord);
+        skip_token();
+        aid = getid();
+        if (aid) {
+            alliance *al = findalliance(aid);
+            if (al && f_get_alliance(fj) != al) {
+                alliance_transaction **tip = transactions + ALLIANCE_INVITE;
+                alliance_transaction *ti = *tip;
+                while (ti) {
+                    faction *fi = ti->u->faction;
+                    if (fi && f_get_alliance(fi) == al) {
+                        int fid;
+                        init_order(ti->ord);
+                        skip_token();
+                        fid = getid();
+                        if (fid == fj->no) {
+                            break;
+                        }
+                    }
+                    tip = &ti->next;
+                    ti = *tip;
+                }
+                if (ti) {
+                    setalliance(fj, al);
+                    *tip = ti->next;
+                    free(ti);
+                }
+                else {
+                    /* TODO: error message */
+                }
             }
-          }
-          tip = &ti->next;
-          ti = *tip;
         }
-        if (ti) {
-          setalliance(fj, al);
-          *tip = ti->next;
-          free(ti);
-        } else {
-          /* TODO: error message */
-        }
-      }
+        *tap = ta->next;
+        free(ta);
     }
-    *tap = ta->next;
-    free(ta);
-  }
 }
 
 static void execute(const struct syntaxtree *syntax, keyword_t kwd)
 {
-  int run = 0;
+    int run = 0;
 
-  region **rp = &regions;
-  while (*rp) {
-    region *r = *rp;
-    unit **up = &r->units;
-    while (*up) {
-      unit *u = *up;
-      if (u->number) {
-        const struct locale *lang = u->faction->locale;
-        void *root = stree_find(syntax, lang);
-        order *ord;
-        for (ord = u->orders; ord; ord = ord->next) {
-          if (getkeyword(ord) == kwd) {
-            do_command(root, u, ord);
-            run = 1;
-          }
+    region **rp = &regions;
+    while (*rp) {
+        region *r = *rp;
+        unit **up = &r->units;
+        while (*up) {
+            unit *u = *up;
+            if (u->number) {
+                const struct locale *lang = u->faction->locale;
+                void *root = stree_find(syntax, lang);
+                order *ord;
+                for (ord = u->orders; ord; ord = ord->next) {
+                    if (getkeyword(ord) == kwd) {
+                        do_command(root, u, ord);
+                        run = 1;
+                    }
+                }
+            }
+            if (u == *up)
+                up = &u->next;
         }
-      }
-      if (u == *up)
-        up = &u->next;
+        if (*rp == r)
+            rp = &r->next;
     }
-    if (*rp == r)
-      rp = &r->next;
-  }
 
-  if (run) {
-    perform_kick();
-    perform_leave();
-    perform_transfer();
-    perform_new();
-    perform_join();
-  }
+    if (run) {
+        perform_kick();
+        perform_leave();
+        perform_transfer();
+        perform_new();
+        perform_join();
+    }
 }
 
 void alliance_cmd(void)
 {
-  static syntaxtree *stree = NULL;
-  if (stree == NULL) {
-    syntaxtree *slang = stree = stree_create();
-    while (slang) {
-      void *leaf = 0;
-      add_command(&leaf, NULL, LOC(slang->lang, "new"), &cmd_new);
-      add_command(&leaf, NULL, LOC(slang->lang, "invite"), &cmd_invite);
-      add_command(&leaf, NULL, LOC(slang->lang, "join"), &cmd_join);
-      add_command(&leaf, NULL, LOC(slang->lang, "kick"), &cmd_kick);
-      add_command(&leaf, NULL, LOC(slang->lang, "leave"), &cmd_leave);
-      add_command(&leaf, NULL, LOC(slang->lang, "command"), &cmd_transfer);
-      slang->root = leaf;
-      slang = slang->next;
+    static syntaxtree *stree = NULL;
+    if (stree == NULL) {
+        syntaxtree *slang = stree = stree_create();
+        while (slang) {
+            void *leaf = 0;
+            add_command(&leaf, NULL, LOC(slang->lang, "new"), &cmd_new);
+            add_command(&leaf, NULL, LOC(slang->lang, "invite"), &cmd_invite);
+            add_command(&leaf, NULL, LOC(slang->lang, "join"), &cmd_join);
+            add_command(&leaf, NULL, LOC(slang->lang, "kick"), &cmd_kick);
+            add_command(&leaf, NULL, LOC(slang->lang, "leave"), &cmd_leave);
+            add_command(&leaf, NULL, LOC(slang->lang, "command"), &cmd_transfer);
+            slang->root = leaf;
+            slang = slang->next;
+        }
     }
-  }
-  execute(stree, K_ALLIANCE);
-  /* some may have been kicked, must remove f->alliance==NULL */
+    execute(stree, K_ALLIANCE);
+    /* some may have been kicked, must remove f->alliance==NULL */
 }
 
 void alliancejoin(void)
 {
-  static syntaxtree *stree = NULL;
-  if (stree == NULL) {
-    syntaxtree *slang = stree = stree_create();
-    while (slang) {
-      void *leaf = 0;
-      add_command(&leaf, NULL, LOC(slang->lang, "join"), &cmd_join);
-      add_command(&slang->root, leaf, LOC(slang->lang, "alliance"), NULL);
-      slang = slang->next;
+    static syntaxtree *stree = NULL;
+    if (stree == NULL) {
+        syntaxtree *slang = stree = stree_create();
+        while (slang) {
+            void *leaf = 0;
+            add_command(&leaf, NULL, LOC(slang->lang, "join"), &cmd_join);
+            add_command(&slang->root, leaf, LOC(slang->lang, "alliance"), NULL);
+            slang = slang->next;
+        }
     }
-  }
-  execute(stree, K_ALLIANCE);
+    execute(stree, K_ALLIANCE);
 }
 
 void setalliance(faction * f, alliance * al)
 {
-  if (f->alliance == al)
-    return;
-  if (f->alliance != NULL) {
-    int qi;
-    quicklist **flistp = &f->alliance->members;
+    if (f->alliance == al)
+        return;
+    if (f->alliance != NULL) {
+        int qi;
+        quicklist **flistp = &f->alliance->members;
 
-    for (qi = 0; *flistp; ql_advance(flistp, &qi, 1)) {
-      faction *data = (faction *) ql_get(*flistp, qi);
-      if (data == f) {
-        ql_delete(flistp, qi);
-        break;
-      }
-    }
+        for (qi = 0; *flistp; ql_advance(flistp, &qi, 1)) {
+            faction *data = (faction *)ql_get(*flistp, qi);
+            if (data == f) {
+                ql_delete(flistp, qi);
+                break;
+            }
+        }
 
-    if (f->alliance->_leader == f) {
-      if (f->alliance->members) {
-        f->alliance->_leader = (faction *) ql_get(f->alliance->members, 0);
-      } else {
-        f->alliance->_leader = NULL;
-      }
+        if (f->alliance->_leader == f) {
+            if (f->alliance->members) {
+                f->alliance->_leader = (faction *)ql_get(f->alliance->members, 0);
+            }
+            else {
+                f->alliance->_leader = NULL;
+            }
+        }
     }
-  }
-  f->alliance = al;
-  f->alliance_joindate = turn;
-  if (al != NULL) {
-    ql_push(&al->members, f);
-    if (al->_leader == NULL) {
-      al->_leader = f;
+    f->alliance = al;
+    f->alliance_joindate = turn;
+    if (al != NULL) {
+        ql_push(&al->members, f);
+        if (al->_leader == NULL) {
+            al->_leader = f;
+        }
     }
-  }
 }
 
 const char *alliancename(const alliance * al)
 {
-  typedef char name[OBJECTIDSIZE + 1];
-  static name idbuf[8];
-  static int nextbuf = 0;
+    typedef char name[OBJECTIDSIZE + 1];
+    static name idbuf[8];
+    static int nextbuf = 0;
 
-  char *ibuf = idbuf[(++nextbuf) % 8];
+    char *ibuf = idbuf[(++nextbuf) % 8];
 
-  if (al && al->name) {
-    slprintf(ibuf, sizeof(name), "%s (%s)", al->name, itoa36(al->id));
-  } else {
-    return NULL;
-  }
-  return ibuf;
+    if (al && al->name) {
+        slprintf(ibuf, sizeof(name), "%s (%s)", al->name, itoa36(al->id));
+    }
+    else {
+        return NULL;
+    }
+    return ibuf;
 }
 
 void alliancevictory(void)
 {
-  const struct building_type *btype = bt_find("stronghold");
-  region *r = regions;
-  alliance *al = alliances;
-  if (btype == NULL)
-    return;
-  while (r != NULL) {
-    building *b = r->buildings;
-    while (b != NULL) {
-      if (b->type == btype) {
-        unit *u = building_owner(b);
-        if (u) {
-          fset(u->faction->alliance, FFL_MARK);
+    const struct building_type *btype = bt_find("stronghold");
+    region *r = regions;
+    alliance *al = alliances;
+    if (btype == NULL)
+        return;
+    while (r != NULL) {
+        building *b = r->buildings;
+        while (b != NULL) {
+            if (b->type == btype) {
+                unit *u = building_owner(b);
+                if (u) {
+                    fset(u->faction->alliance, FFL_MARK);
+                }
+            }
+            b = b->next;
         }
-      }
-      b = b->next;
+        r = r->next;
     }
-    r = r->next;
-  }
-  while (al != NULL) {
-    if (!fval(al, FFL_MARK)) {
-      int qi;
-      quicklist *flist = al->members;
-      for (qi = 0; flist; ql_advance(&flist, &qi, 1)) {
-        faction *f = (faction *) ql_get(flist, qi);
-        if (f->alliance == al) {
-          ADDMSG(&f->msgs, msg_message("alliance::lost", "alliance", al));
-          destroyfaction(f);
+    while (al != NULL) {
+        if (!fval(al, FFL_MARK)) {
+            int qi;
+            quicklist *flist = al->members;
+            for (qi = 0; flist; ql_advance(&flist, &qi, 1)) {
+                faction *f = (faction *)ql_get(flist, qi);
+                if (f->alliance == al) {
+                    ADDMSG(&f->msgs, msg_message("alliance::lost", "alliance", al));
+                    destroyfaction(f);
+                }
+            }
         }
-      }
-    } else {
-      freset(al, FFL_MARK);
+        else {
+            freset(al, FFL_MARK);
+        }
+        al = al->next;
     }
-    al = al->next;
-  }
 }
 
 int victorycondition(const alliance * al, const char *name)
 {
-  const char *gems[] =
+    const char *gems[] =
     { "opal", "diamond", "zaphire", "topaz", "beryl", "agate", "garnet",
-      "emerald", NULL };
-  if (strcmp(name, "gems") == 0) {
-    const char **igem;
+    "emerald", NULL };
+    if (strcmp(name, "gems") == 0) {
+        const char **igem;
 
-    for (igem = gems; *igem; ++igem) {
-      const struct resource_type *rtype = rt_find(*igem);
-      quicklist *flist = al->members;
-      int qi;
-      bool found = false;
+        for (igem = gems; *igem; ++igem) {
+            const struct resource_type *rtype = rt_find(*igem);
+            quicklist *flist = al->members;
+            int qi;
+            bool found = false;
 
-      assert(rtype);
-      for (qi = 0; flist && !found; ql_advance(&flist, &qi, 1)) {
-        faction *f = (faction *) ql_get(flist, 0);
-        unit *u;
+            assert(rtype);
+            for (qi = 0; flist && !found; ql_advance(&flist, &qi, 1)) {
+                faction *f = (faction *)ql_get(flist, 0);
+                unit *u;
 
-        for (u = f->units; u; u = u->nextF) {
-          if (i_get(u->items, rtype->itype) > 0) {
-            found = true;
-            break;
-          }
+                for (u = f->units; u; u = u->nextF) {
+                    if (i_get(u->items, rtype->itype) > 0) {
+                        found = true;
+                        break;
+                    }
+                }
+            }
+            if (!found)
+                return 0;
+        }
+        return 1;
+
+    }
+    else if (strcmp(name, "phoenix") == 0) {
+        quicklist *flist = al->members;
+        int qi;
+
+        for (qi = 0; flist; ql_advance(&flist, &qi, 1)) {
+            faction *f = (faction *)ql_get(flist, qi);
+            if (find_key(f->attribs, atoi36("phnx"))) {
+                return 1;
+            }
+        }
+        return 0;
+
+    }
+    else if (strcmp(name, "pyramid") == 0) {
+
+        /* Logik:
+         * - if (pyr > last_passed_size && pyr > all_others) {
+         *     pyr->passed->counter++;
+         *     for(all_other_pyrs) {
+         *       pyr->passed->counter=0;
+         *     }
+         *
+         *     if(pyr->passed->counter >= 3) {
+         *       set(pyr, passed);
+         *       pyr->owner->set_attrib(pyra);
+         *     }
+         *     last_passed_size = pyr->size;
+         *   }
+         */
+
+        quicklist *flist = al->members;
+        int qi;
+
+        for (qi = 0; flist; ql_advance(&flist, &qi, 1)) {
+            faction *f = (faction *)ql_get(flist, qi);
+            if (find_key(f->attribs, atoi36("pyra"))) {
+                return 1;
+            }
         }
-      }
-      if (!found)
         return 0;
     }
-    return 1;
-
-  } else if (strcmp(name, "phoenix") == 0) {
-    quicklist *flist = al->members;
-    int qi;
-
-    for (qi = 0; flist; ql_advance(&flist, &qi, 1)) {
-      faction *f = (faction *) ql_get(flist, qi);
-      if (find_key(f->attribs, atoi36("phnx"))) {
-        return 1;
-      }
-    }
-    return 0;
-
-  } else if (strcmp(name, "pyramid") == 0) {
-
-    /* Logik:
-     * - if (pyr > last_passed_size && pyr > all_others) {
-     *     pyr->passed->counter++;
-     *     for(all_other_pyrs) {
-     *       pyr->passed->counter=0;
-     *     }
-     *
-     *     if(pyr->passed->counter >= 3) {
-     *       set(pyr, passed);
-     *       pyr->owner->set_attrib(pyra);
-     *     }
-     *     last_passed_size = pyr->size;
-     *   }
-     */
-
-    quicklist *flist = al->members;
-    int qi;
-
-    for (qi = 0; flist; ql_advance(&flist, &qi, 1)) {
-      faction *f = (faction *) ql_get(flist, qi);
-      if (find_key(f->attribs, atoi36("pyra"))) {
-        return 1;
-      }
-    }
-    return 0;
-  }
-  return -1;
+    return -1;
 }
 
 void alliance_setname(alliance * self, const char *name)
 {
-  free(self->name);
-  if (name)
-    self->name = _strdup(name);
-  else
-    self->name = NULL;
+    free(self->name);
+    if (name)
+        self->name = _strdup(name);
+    else
+        self->name = NULL;
 }
 
 bool is_allied(const struct faction *f1, const struct faction *f2) {
diff --git a/src/kernel/alliance.h b/src/kernel/alliance.h
index d3db096af..595522a45 100644
--- a/src/kernel/alliance.h
+++ b/src/kernel/alliance.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,48 +22,48 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  struct plane;
-  struct attrib;
-  struct unit;
-  struct faction;
-  struct region;
+    struct plane;
+    struct attrib;
+    struct unit;
+    struct faction;
+    struct region;
 
-  enum {
-    ALLIANCE_KICK,
-    ALLIANCE_LEAVE,
-    ALLIANCE_TRANSFER,
-    ALLIANCE_NEW,
-    ALLIANCE_INVITE,
-    ALLIANCE_JOIN,
-    ALLIANCE_MAX
-  };
+    enum {
+        ALLIANCE_KICK,
+        ALLIANCE_LEAVE,
+        ALLIANCE_TRANSFER,
+        ALLIANCE_NEW,
+        ALLIANCE_INVITE,
+        ALLIANCE_JOIN,
+        ALLIANCE_MAX
+    };
 
 #define ALF_NON_ALLIED (1<<0)   /* this alliance is just a default for a non-allied faction */
 
 #define ALLY_ENEMY (1<<0)
 
-  typedef struct alliance {
-    struct alliance *next;
-    struct faction *_leader;
-    struct quicklist *members;
-    int flags;
-    int id;
-    char *name;
-    struct ally *allies;
-  } alliance;
+    typedef struct alliance {
+        struct alliance *next;
+        struct faction *_leader;
+        struct quicklist *members;
+        int flags;
+        int id;
+        char *name;
+        struct ally *allies;
+    } alliance;
 
-  extern alliance *alliances;
-  extern alliance *findalliance(int id);
-  extern alliance *makealliance(int id, const char *name);
-  extern const char *alliancename(const struct alliance *al);
-  extern void setalliance(struct faction *f, alliance * al);
-  void free_alliances(void);
-  extern struct faction *alliance_get_leader(struct alliance *al);
-  extern void alliance_cmd(void);
-  bool is_allied(const struct faction *f1, const struct faction *f2);
+    extern alliance *alliances;
+    extern alliance *findalliance(int id);
+    extern alliance *makealliance(int id, const char *name);
+    extern const char *alliancename(const struct alliance *al);
+    extern void setalliance(struct faction *f, alliance * al);
+    void free_alliances(void);
+    extern struct faction *alliance_get_leader(struct alliance *al);
+    extern void alliance_cmd(void);
+    bool is_allied(const struct faction *f1, const struct faction *f2);
 
-  void alliance_setname(alliance * self, const char *name);
-/* execute commands */
+    void alliance_setname(alliance * self, const char *name);
+    /* execute commands */
 
 #ifdef __cplusplus
 }
diff --git a/src/kernel/ally.h b/src/kernel/ally.h
index 5e09b721c..60226c8fb 100644
--- a/src/kernel/ally.h
+++ b/src/kernel/ally.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -23,15 +23,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  typedef struct ally {
-    struct ally *next;
-    struct faction *faction;
-    int status;
-  } ally;
+    typedef struct ally {
+        struct ally *next;
+        struct faction *faction;
+        int status;
+    } ally;
 
-  ally * ally_find(ally *al, const struct faction *f);
-  ally * ally_add(ally **al_p, struct faction *f);
-  void ally_remove(ally **al_p, struct faction *f);
+    ally * ally_find(ally *al, const struct faction *f);
+    ally * ally_add(ally **al_p, struct faction *f);
+    void ally_remove(ally **al_p, struct faction *f);
 
 #ifdef __cplusplus
 }
diff --git a/src/kernel/build.c b/src/kernel/build.c
index a3abdf43e..bc14487e5 100644
--- a/src/kernel/build.c
+++ b/src/kernel/build.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/kernel/build.h b/src/kernel/build.h
index 8bd41e409..3f2d04e49 100644
--- a/src/kernel/build.h
+++ b/src/kernel/build.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -27,66 +27,66 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-/* Die enums fuer Gebauede werden nie gebraucht, nur bei der Bestimmung
- * des Schutzes durch eine Burg wird die Reihenfolge und MAXBUILDINGS
- * wichtig
- */
-
-  struct xml_tag;
-
-  typedef struct requirement {
-    const struct resource_type *rtype;
-    int number;
-  } requirement;
-
-  typedef struct construction {
-    skill_t skill;              /* skill req'd per point of size */
-    int minskill;               /* skill req'd per point of size */
-
-    int maxsize;                /* maximum size of this type */
-    int reqsize;                /* size of object using up 1 set of requirement. */
-    int defense_bonus;          /* protection bonus (defense) during combat */
-    int close_combat_bonus;     /* close combat attack bonus*/
-    int ranged_bonus;           /* ranged attack bonus */
-    requirement *materials;     /* material req'd to build one object */
-    const struct building_type *btype;
-    /* building type required to make this thing */
-
-    struct construction *improvement;
-    /* next level, if upgradable. if more than one of these items
-     * can be built (weapons, armour) per turn, must not be NULL,
-     * but point to the same type again:
-     *   const_sword.improvement = &const_sword
-     * last level of a building points to NULL, as do objects of
-     * an unlimited size.
+    /* Die enums fuer Gebauede werden nie gebraucht, nur bei der Bestimmung
+     * des Schutzes durch eine Burg wird die Reihenfolge und MAXBUILDINGS
+     * wichtig
      */
-    struct attrib *attribs;
-    /* stores skill modifiers and other attributes */
 
-  } construction;
+    struct xml_tag;
 
-  extern int destroy_cmd(struct unit *u, struct order *ord);
-  extern int leave_cmd(struct unit *u, struct order *ord);
+    typedef struct requirement {
+        const struct resource_type *rtype;
+        int number;
+    } requirement;
 
-  void build_road(struct region *r, struct unit *u, int size, direction_t d);
-  void create_ship(struct region *r, struct unit *u,
-    const struct ship_type *newtype, int size, struct order *ord);
-  void continue_ship(struct region *r, struct unit *u, int size);
+    typedef struct construction {
+        skill_t skill;              /* skill req'd per point of size */
+        int minskill;               /* skill req'd per point of size */
 
-  struct building *getbuilding(const struct region *r);
-  struct ship *getship(const struct region *r);
+        int maxsize;                /* maximum size of this type */
+        int reqsize;                /* size of object using up 1 set of requirement. */
+        int defense_bonus;          /* protection bonus (defense) during combat */
+        int close_combat_bonus;     /* close combat attack bonus*/
+        int ranged_bonus;           /* ranged attack bonus */
+        requirement *materials;     /* material req'd to build one object */
+        const struct building_type *btype;
+        /* building type required to make this thing */
 
-  void reportevent(struct region *r, char *s);
+        struct construction *improvement;
+        /* next level, if upgradable. if more than one of these items
+         * can be built (weapons, armour) per turn, must not be NULL,
+         * but point to the same type again:
+         *   const_sword.improvement = &const_sword
+         * last level of a building points to NULL, as do objects of
+         * an unlimited size.
+         */
+        struct attrib *attribs;
+        /* stores skill modifiers and other attributes */
 
-  void shash(struct ship *sh);
-  void sunhash(struct ship *sh);
-  extern int roqf_factor(void);
+    } construction;
 
-  int build(struct unit *u, const construction * ctype, int completed, int want);
-  extern int maxbuild(const struct unit *u, const construction * cons);
-  extern struct message *msg_materials_required(struct unit *u,
+    extern int destroy_cmd(struct unit *u, struct order *ord);
+    extern int leave_cmd(struct unit *u, struct order *ord);
+
+    void build_road(struct region *r, struct unit *u, int size, direction_t d);
+    void create_ship(struct region *r, struct unit *u,
+        const struct ship_type *newtype, int size, struct order *ord);
+    void continue_ship(struct region *r, struct unit *u, int size);
+
+    struct building *getbuilding(const struct region *r);
+    struct ship *getship(const struct region *r);
+
+    void reportevent(struct region *r, char *s);
+
+    void shash(struct ship *sh);
+    void sunhash(struct ship *sh);
+    extern int roqf_factor(void);
+
+    int build(struct unit *u, const construction * ctype, int completed, int want);
+    extern int maxbuild(const struct unit *u, const construction * cons);
+    extern struct message *msg_materials_required(struct unit *u,
     struct order *ord, const struct construction *ctype, int multi);
-/** error messages that build may return: */
+    /** error messages that build may return: */
 #define ELOWSKILL -1
 #define ENEEDSKILL -2
 #define ECOMPLETE -3
diff --git a/src/kernel/build.test.c b/src/kernel/build.test.c
index 7e74c5cbb..3ee3cf056 100644
--- a/src/kernel/build.test.c
+++ b/src/kernel/build.test.c
@@ -102,7 +102,7 @@ static void test_build_failure_low_skill(CuTest *tc) {
     u = setup_build(&bf);
     rtype = bf.cons.materials[0].rtype;
     i_change(&u->items, rtype->itype, 1);
-    set_level(u, SK_ARMORER, bf.cons.minskill-1);
+    set_level(u, SK_ARMORER, bf.cons.minskill - 1);
     CuAssertIntEquals(tc, ELOWSKILL, build(u, &bf.cons, 0, 10));
     test_cleanup();
 }
@@ -184,7 +184,7 @@ static void test_build_with_potion(CuTest *tc) {
     CuAssertIntEquals(tc, 2, build(u, &bf.cons, 0, 20));
     CuAssertIntEquals(tc, 18, i_get(u->items, rtype->itype));
     CuAssertIntEquals(tc, 3, get_effect(u, ptype));
-    set_level(u, SK_ARMORER, bf.cons.minskill*2);
+    set_level(u, SK_ARMORER, bf.cons.minskill * 2);
     CuAssertIntEquals(tc, 4, build(u, &bf.cons, 0, 20));
     CuAssertIntEquals(tc, 2, get_effect(u, ptype));
     set_level(u, SK_ARMORER, bf.cons.minskill);
@@ -242,7 +242,7 @@ static void test_build_building_success(CuTest *tc) {
     assert(btype && rtype && rtype->itype);
     assert(btype->construction);
     assert(!u->region->buildings);
-    
+
     i_change(&bf.u->items, rtype->itype, 1);
     set_level(u, SK_BUILDING, 1);
     CuAssertIntEquals(tc, 1, build_building(u, btype, 0, 4, 0));
diff --git a/src/kernel/building.c b/src/kernel/building.c
index f74976661..7d4dcde73 100644
--- a/src/kernel/building.c
+++ b/src/kernel/building.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
@@ -93,7 +93,7 @@ void bt_register(building_type * type)
 }
 
 void free_buildingtype(void *ptr) {
-    building_type *btype =(building_type *)ptr;
+    building_type *btype = (building_type *)ptr;
     free(btype->_name);
     free(btype);
 }
@@ -330,7 +330,7 @@ static int building_protection(building * b, unit * u, building_bonus bonus)
     {
         cons = cons->improvement;
     }
-    
+
     switch (bonus)
     {
     case DEFENSE_BONUS:
diff --git a/src/kernel/building.h b/src/kernel/building.h
index 98db1bd2f..6b77ae11d 100644
--- a/src/kernel/building.h
+++ b/src/kernel/building.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -26,18 +26,18 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-/* maintenance::flags */
+    /* maintenance::flags */
 #define MTF_NONE     0x00
 #define MTF_VARIABLE 0x01       /* resource usage scales with size */
 #define MTF_VITAL    0x02       /* if resource missing, building may crash */
 
-  typedef struct maintenance {
-    const struct resource_type *rtype;  /* type of resource required */
-    int number;                 /* amount of resources */
-    int flags;         /* misc. flags */
-  } maintenance;
+    typedef struct maintenance {
+        const struct resource_type *rtype;  /* type of resource required */
+        int number;                 /* amount of resources */
+        int flags;         /* misc. flags */
+    } maintenance;
 
-/* building_type::flags */
+    /* building_type::flags */
 #define BTF_NONE           0x00
 #define BTF_INDESTRUCTIBLE 0x01 /* cannot be torm down */
 #define BTF_NOBUILD        0x02 /* special, can't be built */
@@ -48,54 +48,54 @@ extern "C" {
 #define BTF_ONEPERTURN     0x80 /* one one sizepoint can be added per turn */
 #define BTF_NAMECHANGE    0x100 /* name and description can be changed more than once */
 
-  typedef enum {
-      DEFENSE_BONUS,
-      CLOSE_COMBAT_ATTACK_BONUS,
-      RANGED_ATTACK_BONUS,
-  } building_bonus;
+    typedef enum {
+        DEFENSE_BONUS,
+        CLOSE_COMBAT_ATTACK_BONUS,
+        RANGED_ATTACK_BONUS,
+    } building_bonus;
 
-  typedef struct building_type {
-    char *_name;
+    typedef struct building_type {
+        char *_name;
 
-    int flags;                  /* flags */
-    int capacity;               /* Kapazit�t pro Gr��enpunkt */
-    int maxcapacity;            /* Max. Kapazit�t */
-    int maxsize;                /* how big can it get, with all the extensions? */
-    int magres;                 /* how well it resists against spells */
-    int magresbonus;            /* bonus it gives the target against spells */
-    int fumblebonus;            /* bonus that reduces fumbling */
-    double auraregen;           /* modifier for aura regeneration inside building */
-    struct maintenance *maintenance;    /* array of requirements */
-    struct construction *construction;  /* construction of 1 building-level */
+        int flags;                  /* flags */
+        int capacity;               /* Kapazit�t pro Gr��enpunkt */
+        int maxcapacity;            /* Max. Kapazit�t */
+        int maxsize;                /* how big can it get, with all the extensions? */
+        int magres;                 /* how well it resists against spells */
+        int magresbonus;            /* bonus it gives the target against spells */
+        int fumblebonus;            /* bonus that reduces fumbling */
+        double auraregen;           /* modifier for aura regeneration inside building */
+        struct maintenance *maintenance;    /* array of requirements */
+        struct construction *construction;  /* construction of 1 building-level */
 
-    const char *(*name) (const struct building_type *,
-      const struct building * b, int size);
-    void (*init) (struct building_type *);
-    void (*age) (struct building *);
-    int (*protection) (struct building *, struct unit *, building_bonus);
-    double (*taxes) (const struct building *, int size);
-    struct attrib *attribs;
-  } building_type;
+        const char *(*name) (const struct building_type *,
+            const struct building * b, int size);
+        void(*init) (struct building_type *);
+        void(*age) (struct building *);
+        int(*protection) (struct building *, struct unit *, building_bonus);
+        double(*taxes) (const struct building *, int size);
+        struct attrib *attribs;
+    } building_type;
 
-  extern struct quicklist *buildingtypes;
+    extern struct quicklist *buildingtypes;
 
-  building_type *bt_get_or_create(const char *name);
-  const building_type *bt_find(const char *name);
-  void free_buildingtypes(void);
-  void register_buildings(void);
-  void bt_register(struct building_type *type);
-  int bt_effsize(const struct building_type *btype,
-    const struct building *b, int bsize);
+    building_type *bt_get_or_create(const char *name);
+    const building_type *bt_find(const char *name);
+    void free_buildingtypes(void);
+    void register_buildings(void);
+    void bt_register(struct building_type *type);
+    int bt_effsize(const struct building_type *btype,
+        const struct building *b, int bsize);
 
-/* buildingt => building_type
- * Name => locale_string(name)
- * MaxGroesse => levels
- * MinBauTalent => construction->minskill
- * Kapazitaet => capacity, maxcapacity
- * Materialien => construction->materials
- * UnterSilber, UnterSpezialTyp, UnterSpezial => maintenance
- * per_size => !maintenance->fixed
- */
+    /* buildingt => building_type
+     * Name => locale_string(name)
+     * MaxGroesse => levels
+     * MinBauTalent => construction->minskill
+     * Kapazitaet => capacity, maxcapacity
+     * Materialien => construction->materials
+     * UnterSilber, UnterSpezialTyp, UnterSpezial => maintenance
+     * per_size => !maintenance->fixed
+     */
 #define BFL_NONE           0x00
 #define BLD_MAINTAINED     0x01 /* vital maintenance paid for */
 #define BLD_WORKING        0x02 /* full maintenance paid, it works */
@@ -106,76 +106,76 @@ extern "C" {
 
 #define BLD_SAVEMASK       0x00 /* mask for persistent flags */
 
-  typedef struct building {
-    struct building *next;
-    struct building *nexthash;
+    typedef struct building {
+        struct building *next;
+        struct building *nexthash;
 
-    const struct building_type *type;
-    struct region *region;
-    struct unit *_owner; /* you should always use building_owner(), never this naked pointer */
-    char *name;
-    char *display;
-    struct attrib *attribs;
-    int no;
-    int size;
-    int sizeleft;               /* is only used during battle. should be a temporary attribute */
-    int besieged;               /* should be an attribute */
-    int flags;
-  } building;
+        const struct building_type *type;
+        struct region *region;
+        struct unit *_owner; /* you should always use building_owner(), never this naked pointer */
+        char *name;
+        char *display;
+        struct attrib *attribs;
+        int no;
+        int size;
+        int sizeleft;               /* is only used during battle. should be a temporary attribute */
+        int besieged;               /* should be an attribute */
+        int flags;
+    } building;
 
-  extern struct attrib_type at_building_generic_type;
-  extern const char *buildingtype(const building_type * btype,
-    const struct building *b, int bsize);
-  extern const char *write_buildingname(const building * b, char *ibuf,
-    size_t size);
-  extern int buildingcapacity(const struct building *b);
-  extern struct building *new_building(const struct building_type *typ,
+    extern struct attrib_type at_building_generic_type;
+    extern const char *buildingtype(const building_type * btype,
+        const struct building *b, int bsize);
+    extern const char *write_buildingname(const building * b, char *ibuf,
+        size_t size);
+    extern int buildingcapacity(const struct building *b);
+    extern struct building *new_building(const struct building_type *typ,
     struct region *r, const struct locale *lang);
-  int build_building(struct unit *u, const struct building_type *typ, 
-                      int id, int size, struct order *ord);
+    int build_building(struct unit *u, const struct building_type *typ,
+        int id, int size, struct order *ord);
 
-/* Alte Geb�udetypen: */
+    /* Alte Geb�udetypen: */
 
-/* old functions, still in build.c: */
-  int buildingeffsize(const building * b, int imaginary);
-  void bhash(struct building *b);
-  void bunhash(struct building *b);
-  int buildingcapacity(const struct building *b);
+    /* old functions, still in build.c: */
+    int buildingeffsize(const building * b, int imaginary);
+    void bhash(struct building *b);
+    void bunhash(struct building *b);
+    int buildingcapacity(const struct building *b);
 
-  extern void remove_building(struct building **blist, struct building *b);
-  extern void free_building(struct building *b);
-  extern void free_buildings(void);
+    extern void remove_building(struct building **blist, struct building *b);
+    extern void free_building(struct building *b);
+    extern void free_buildings(void);
 
-  const struct building_type *findbuildingtype(const char *name,
-    const struct locale *lang);
+    const struct building_type *findbuildingtype(const char *name,
+        const struct locale *lang);
 
 #include "build.h"
 #define NOBUILDING NULL
 
-  extern int resolve_building(variant data, void *address);
-  extern void write_building_reference(const struct building *b,
+    extern int resolve_building(variant data, void *address);
+    extern void write_building_reference(const struct building *b,
     struct storage *store);
-  extern variant read_building_reference(struct storage *store);
+    extern variant read_building_reference(struct storage *store);
 
-  extern struct building *findbuilding(int n);
+    extern struct building *findbuilding(int n);
 
-  extern struct unit *building_owner(const struct building *b);
-  extern void building_set_owner(struct unit * u);
-  extern void building_update_owner(struct building * bld);
+    extern struct unit *building_owner(const struct building *b);
+    extern void building_set_owner(struct unit * u);
+    extern void building_update_owner(struct building * bld);
 
-  extern struct attrib_type at_building_action;
+    extern struct attrib_type at_building_action;
 
 #ifdef WDW_PYRAMID
-  extern int wdw_pyramid_level(const struct building *b);
+    extern int wdw_pyramid_level(const struct building *b);
 #endif
 
-  extern const char *buildingname(const struct building *b);
+    extern const char *buildingname(const struct building *b);
 
-  extern const char *building_getname(const struct building *b);
-  extern void building_setname(struct building *self, const char *name);
+    extern const char *building_getname(const struct building *b);
+    extern void building_setname(struct building *self, const char *name);
 
-  struct region *building_getregion(const struct building *b);
-  void building_setregion(struct building *bld, struct region *r);
+    struct region *building_getregion(const struct building *b);
+    void building_setregion(struct building *bld, struct region *r);
 
 #ifdef __cplusplus
 }
diff --git a/src/kernel/building.test.c b/src/kernel/building.test.c
index 2295c8193..6a7d0c17a 100644
--- a/src/kernel/building.test.c
+++ b/src/kernel/building.test.c
@@ -13,362 +13,362 @@
 
 static void test_register_building(CuTest * tc)
 {
-  building_type *btype;
+    building_type *btype;
 
-  test_cleanup();
+    test_cleanup();
 
-  btype = (building_type *)calloc(sizeof(building_type), 1);
-  btype->_name = _strdup("herp");
-  bt_register(btype);
+    btype = (building_type *)calloc(sizeof(building_type), 1);
+    btype->_name = _strdup("herp");
+    bt_register(btype);
 
-  CuAssertPtrNotNull(tc, bt_find("herp"));
-//    free(btype->_name);
-//    free(btype);
-  test_cleanup();
+    CuAssertPtrNotNull(tc, bt_find("herp"));
+    //    free(btype->_name);
+    //    free(btype);
+    test_cleanup();
 }
 
 static void test_building_set_owner(CuTest * tc)
 {
-  struct region *r;
-  struct building *bld;
-  struct unit *u1, *u2;
-  struct faction *f;
-  const struct building_type *btype;
-  const struct race *human;
+    struct region *r;
+    struct building *bld;
+    struct unit *u1, *u2;
+    struct faction *f;
+    const struct building_type *btype;
+    const struct race *human;
 
-  test_cleanup();
-  test_create_world();
+    test_cleanup();
+    test_create_world();
 
-  human = rc_find("human");
-  btype = bt_find("castle");
-  f = test_create_faction(human);
-  r = findregion(0, 0);
+    human = rc_find("human");
+    btype = bt_find("castle");
+    f = test_create_faction(human);
+    r = findregion(0, 0);
 
-  bld = test_create_building(r, btype);
-  u1 = test_create_unit(f, r);
-  u_set_building(u1, bld);
-  CuAssertPtrEquals(tc, u1, building_owner(bld));
+    bld = test_create_building(r, btype);
+    u1 = test_create_unit(f, r);
+    u_set_building(u1, bld);
+    CuAssertPtrEquals(tc, u1, building_owner(bld));
 
-  u2 = test_create_unit(f, r);
-  u_set_building(u2, bld);
-  CuAssertPtrEquals(tc, u1, building_owner(bld));
-  building_set_owner(u2);
-  CuAssertPtrEquals(tc, u2, building_owner(bld));
-  test_cleanup();
+    u2 = test_create_unit(f, r);
+    u_set_building(u2, bld);
+    CuAssertPtrEquals(tc, u1, building_owner(bld));
+    building_set_owner(u2);
+    CuAssertPtrEquals(tc, u2, building_owner(bld));
+    test_cleanup();
 }
 
 static void test_buildingowner_goes_to_next_when_empty(CuTest * tc)
 {
-  struct region *r;
-  struct building *bld;
-  struct unit *u, *u2;
-  struct faction *f;
-  const struct building_type *btype;
-  const struct race *human;
+    struct region *r;
+    struct building *bld;
+    struct unit *u, *u2;
+    struct faction *f;
+    const struct building_type *btype;
+    const struct race *human;
 
-  test_cleanup();
-  test_create_world();
+    test_cleanup();
+    test_create_world();
 
-  human = rc_find("human");
-  CuAssertPtrNotNull(tc, human);
+    human = rc_find("human");
+    CuAssertPtrNotNull(tc, human);
 
-  btype = bt_find("castle");
-  CuAssertPtrNotNull(tc, btype);
+    btype = bt_find("castle");
+    CuAssertPtrNotNull(tc, btype);
 
-  f = test_create_faction(human);
-  r = findregion(0, 0);
+    f = test_create_faction(human);
+    r = findregion(0, 0);
 
-  bld = test_create_building(r, btype);
-  CuAssertPtrNotNull(tc, bld);
+    bld = test_create_building(r, btype);
+    CuAssertPtrNotNull(tc, bld);
 
-  u = test_create_unit(f, r);
-  u2 = test_create_unit(f, r);
-  CuAssertPtrNotNull(tc, u);
-  u_set_building(u, bld);
-  u_set_building(u2, bld);
-  CuAssertPtrEquals(tc, u, building_owner(bld));
-  u->number = 0;
-  CuAssertPtrEquals(tc, u2, building_owner(bld));
-  test_cleanup();
+    u = test_create_unit(f, r);
+    u2 = test_create_unit(f, r);
+    CuAssertPtrNotNull(tc, u);
+    u_set_building(u, bld);
+    u_set_building(u2, bld);
+    CuAssertPtrEquals(tc, u, building_owner(bld));
+    u->number = 0;
+    CuAssertPtrEquals(tc, u2, building_owner(bld));
+    test_cleanup();
 }
 
 static void test_buildingowner_goes_to_other_when_empty(CuTest * tc)
 {
-  struct region *r;
-  struct building *bld;
-  struct unit *u, *u2;
-  struct faction *f;
-  const struct building_type *btype;
-  const struct race *human;
+    struct region *r;
+    struct building *bld;
+    struct unit *u, *u2;
+    struct faction *f;
+    const struct building_type *btype;
+    const struct race *human;
 
-  test_cleanup();
-  test_create_world();
+    test_cleanup();
+    test_create_world();
 
-  human = rc_find("human");
-  CuAssertPtrNotNull(tc, human);
+    human = rc_find("human");
+    CuAssertPtrNotNull(tc, human);
 
-  btype = bt_find("castle");
-  CuAssertPtrNotNull(tc, btype);
+    btype = bt_find("castle");
+    CuAssertPtrNotNull(tc, btype);
 
-  f = test_create_faction(human);
-  r = findregion(0, 0);
+    f = test_create_faction(human);
+    r = findregion(0, 0);
 
-  bld = test_create_building(r, btype);
-  CuAssertPtrNotNull(tc, bld);
+    bld = test_create_building(r, btype);
+    CuAssertPtrNotNull(tc, bld);
 
-  u2 = test_create_unit(f, r);
-  u = test_create_unit(f, r);
-  CuAssertPtrNotNull(tc, u);
-  u_set_building(u, bld);
-  CuAssertPtrEquals(tc, u, building_owner(bld));
-  u_set_building(u2, bld);
-  CuAssertPtrEquals(tc, u, building_owner(bld));
-  u->number = 0;
-  CuAssertPtrEquals(tc, u2, building_owner(bld));
-  test_cleanup();
+    u2 = test_create_unit(f, r);
+    u = test_create_unit(f, r);
+    CuAssertPtrNotNull(tc, u);
+    u_set_building(u, bld);
+    CuAssertPtrEquals(tc, u, building_owner(bld));
+    u_set_building(u2, bld);
+    CuAssertPtrEquals(tc, u, building_owner(bld));
+    u->number = 0;
+    CuAssertPtrEquals(tc, u2, building_owner(bld));
+    test_cleanup();
 }
 
 static void test_buildingowner_goes_to_same_faction_when_empty(CuTest * tc)
 {
-  struct region *r;
-  struct building *bld;
-  struct unit *u, *u2, *u3;
-  struct faction *f1, *f2;
-  const struct building_type *btype;
-  const struct race *human;
+    struct region *r;
+    struct building *bld;
+    struct unit *u, *u2, *u3;
+    struct faction *f1, *f2;
+    const struct building_type *btype;
+    const struct race *human;
 
-  test_cleanup();
-  test_create_world();
+    test_cleanup();
+    test_create_world();
 
-  human = rc_find("human");
-  CuAssertPtrNotNull(tc, human);
+    human = rc_find("human");
+    CuAssertPtrNotNull(tc, human);
 
-  btype = bt_find("castle");
-  CuAssertPtrNotNull(tc, btype);
+    btype = bt_find("castle");
+    CuAssertPtrNotNull(tc, btype);
 
-  f1 = test_create_faction(human);
-  f2 = test_create_faction(human);
-  r = findregion(0, 0);
+    f1 = test_create_faction(human);
+    f2 = test_create_faction(human);
+    r = findregion(0, 0);
 
-  bld = test_create_building(r, btype);
-  CuAssertPtrNotNull(tc, bld);
+    bld = test_create_building(r, btype);
+    CuAssertPtrNotNull(tc, bld);
 
-  u2 = test_create_unit(f2, r);
-  u3 = test_create_unit(f1, r);
-  u = test_create_unit(f1, r);
-  CuAssertPtrNotNull(tc, u);
-  u_set_building(u, bld);
-  u_set_building(u2, bld);
-  u_set_building(u3, bld);
-  CuAssertPtrEquals(tc, u, building_owner(bld));
-  u->number = 0;
-  CuAssertPtrEquals(tc, u3, building_owner(bld));
-  u3->number = 0;
-  CuAssertPtrEquals(tc, u2, building_owner(bld));
-  test_cleanup();
+    u2 = test_create_unit(f2, r);
+    u3 = test_create_unit(f1, r);
+    u = test_create_unit(f1, r);
+    CuAssertPtrNotNull(tc, u);
+    u_set_building(u, bld);
+    u_set_building(u2, bld);
+    u_set_building(u3, bld);
+    CuAssertPtrEquals(tc, u, building_owner(bld));
+    u->number = 0;
+    CuAssertPtrEquals(tc, u3, building_owner(bld));
+    u3->number = 0;
+    CuAssertPtrEquals(tc, u2, building_owner(bld));
+    test_cleanup();
 }
 
 static void test_buildingowner_goes_to_next_after_leave(CuTest * tc)
 {
-  struct region *r;
-  struct building *bld;
-  struct unit *u, *u2;
-  struct faction *f;
-  const struct building_type *btype;
-  const struct race *human;
+    struct region *r;
+    struct building *bld;
+    struct unit *u, *u2;
+    struct faction *f;
+    const struct building_type *btype;
+    const struct race *human;
 
-  test_cleanup();
-  test_create_world();
+    test_cleanup();
+    test_create_world();
 
-  human = rc_find("human");
-  CuAssertPtrNotNull(tc, human);
+    human = rc_find("human");
+    CuAssertPtrNotNull(tc, human);
 
-  btype = bt_find("castle");
-  CuAssertPtrNotNull(tc, btype);
+    btype = bt_find("castle");
+    CuAssertPtrNotNull(tc, btype);
 
-  f = test_create_faction(human);
-  r = findregion(0, 0);
+    f = test_create_faction(human);
+    r = findregion(0, 0);
 
-  bld = test_create_building(r, btype);
-  CuAssertPtrNotNull(tc, bld);
+    bld = test_create_building(r, btype);
+    CuAssertPtrNotNull(tc, bld);
 
-  u = test_create_unit(f, r);
-  u2 = test_create_unit(f, r);
-  CuAssertPtrNotNull(tc, u);
-  u_set_building(u, bld);
-  u_set_building(u2, bld);
-  CuAssertPtrEquals(tc, u, building_owner(bld));
-  leave_building(u);
-  CuAssertPtrEquals(tc, u2, building_owner(bld));
-  test_cleanup();
+    u = test_create_unit(f, r);
+    u2 = test_create_unit(f, r);
+    CuAssertPtrNotNull(tc, u);
+    u_set_building(u, bld);
+    u_set_building(u2, bld);
+    CuAssertPtrEquals(tc, u, building_owner(bld));
+    leave_building(u);
+    CuAssertPtrEquals(tc, u2, building_owner(bld));
+    test_cleanup();
 }
 
 static void test_buildingowner_goes_to_other_after_leave(CuTest * tc)
 {
-  struct region *r;
-  struct building *bld;
-  struct unit *u, *u2;
-  struct faction *f;
-  const struct building_type *btype;
-  const struct race *human;
+    struct region *r;
+    struct building *bld;
+    struct unit *u, *u2;
+    struct faction *f;
+    const struct building_type *btype;
+    const struct race *human;
 
-  test_cleanup();
-  test_create_world();
+    test_cleanup();
+    test_create_world();
 
-  human = rc_find("human");
-  CuAssertPtrNotNull(tc, human);
+    human = rc_find("human");
+    CuAssertPtrNotNull(tc, human);
 
-  btype = bt_find("castle");
-  CuAssertPtrNotNull(tc, btype);
+    btype = bt_find("castle");
+    CuAssertPtrNotNull(tc, btype);
 
-  f = test_create_faction(human);
-  r = findregion(0, 0);
+    f = test_create_faction(human);
+    r = findregion(0, 0);
 
-  bld = test_create_building(r, btype);
-  CuAssertPtrNotNull(tc, bld);
+    bld = test_create_building(r, btype);
+    CuAssertPtrNotNull(tc, bld);
 
-  u2 = test_create_unit(f, r);
-  u = test_create_unit(f, r);
-  CuAssertPtrNotNull(tc, u);
-  u_set_building(u, bld);
-  u_set_building(u2, bld);
-  CuAssertPtrEquals(tc, u, building_owner(bld));
-  leave_building(u);
-  CuAssertPtrEquals(tc, u2, building_owner(bld));
-  test_cleanup();
+    u2 = test_create_unit(f, r);
+    u = test_create_unit(f, r);
+    CuAssertPtrNotNull(tc, u);
+    u_set_building(u, bld);
+    u_set_building(u2, bld);
+    CuAssertPtrEquals(tc, u, building_owner(bld));
+    leave_building(u);
+    CuAssertPtrEquals(tc, u2, building_owner(bld));
+    test_cleanup();
 }
 
 static void test_buildingowner_goes_to_same_faction_after_leave(CuTest * tc)
 {
-  struct region *r;
-  struct building *bld;
-  struct unit *u, *u2, *u3;
-  struct faction *f1, *f2;
-  const struct building_type *btype;
-  const struct race *human;
+    struct region *r;
+    struct building *bld;
+    struct unit *u, *u2, *u3;
+    struct faction *f1, *f2;
+    const struct building_type *btype;
+    const struct race *human;
 
-  test_cleanup();
-  test_create_world();
+    test_cleanup();
+    test_create_world();
 
-  human = rc_find("human");
-  CuAssertPtrNotNull(tc, human);
+    human = rc_find("human");
+    CuAssertPtrNotNull(tc, human);
 
-  btype = bt_find("castle");
-  CuAssertPtrNotNull(tc, btype);
+    btype = bt_find("castle");
+    CuAssertPtrNotNull(tc, btype);
 
-  f1 = test_create_faction(human);
-  f2 = test_create_faction(human);
-  r = findregion(0, 0);
+    f1 = test_create_faction(human);
+    f2 = test_create_faction(human);
+    r = findregion(0, 0);
 
-  bld = test_create_building(r, btype);
-  CuAssertPtrNotNull(tc, bld);
+    bld = test_create_building(r, btype);
+    CuAssertPtrNotNull(tc, bld);
 
-  u2 = test_create_unit(f2, r);
-  u3 = test_create_unit(f1, r);
-  u = test_create_unit(f1, r);
-  CuAssertPtrNotNull(tc, u);
-  u_set_building(u, bld);
-  u_set_building(u2, bld);
-  u_set_building(u3, bld);
-  CuAssertPtrEquals(tc, u, building_owner(bld));
-  leave_building(u);
-  CuAssertPtrEquals(tc, u3, building_owner(bld));
-  leave_building(u3);
-  CuAssertPtrEquals(tc, u2, building_owner(bld));
-  leave_building(u2);
-  CuAssertPtrEquals(tc, 0, building_owner(bld));
-  test_cleanup();
+    u2 = test_create_unit(f2, r);
+    u3 = test_create_unit(f1, r);
+    u = test_create_unit(f1, r);
+    CuAssertPtrNotNull(tc, u);
+    u_set_building(u, bld);
+    u_set_building(u2, bld);
+    u_set_building(u3, bld);
+    CuAssertPtrEquals(tc, u, building_owner(bld));
+    leave_building(u);
+    CuAssertPtrEquals(tc, u3, building_owner(bld));
+    leave_building(u3);
+    CuAssertPtrEquals(tc, u2, building_owner(bld));
+    leave_building(u2);
+    CuAssertPtrEquals(tc, 0, building_owner(bld));
+    test_cleanup();
 }
 
 static void test_buildingowner_resets_when_empty(CuTest * tc)
 {
-  struct region *r;
-  struct building *bld;
-  struct unit *u;
-  struct faction *f;
-  const struct building_type *btype;
-  const struct race *human;
+    struct region *r;
+    struct building *bld;
+    struct unit *u;
+    struct faction *f;
+    const struct building_type *btype;
+    const struct race *human;
 
-  test_cleanup();
-  test_create_world();
+    test_cleanup();
+    test_create_world();
 
-  human = rc_find("human");
-  CuAssertPtrNotNull(tc, human);
+    human = rc_find("human");
+    CuAssertPtrNotNull(tc, human);
 
-  btype = bt_find("castle");
-  CuAssertPtrNotNull(tc, btype);
+    btype = bt_find("castle");
+    CuAssertPtrNotNull(tc, btype);
 
-  f = test_create_faction(human);
-  r = findregion(0, 0);
+    f = test_create_faction(human);
+    r = findregion(0, 0);
 
-  bld = test_create_building(r, btype);
-  CuAssertPtrNotNull(tc, bld);
+    bld = test_create_building(r, btype);
+    CuAssertPtrNotNull(tc, bld);
 
-  u = test_create_unit(f, r);
-  CuAssertPtrNotNull(tc, u);
-  u_set_building(u, bld);
-  CuAssertPtrEquals(tc, u, building_owner(bld));
-  u->number = 0;
-  CuAssertPtrEquals(tc, 0, building_owner(bld));
-  u->number = 1;
-  CuAssertPtrEquals(tc, u, building_owner(bld));
-  test_cleanup();
+    u = test_create_unit(f, r);
+    CuAssertPtrNotNull(tc, u);
+    u_set_building(u, bld);
+    CuAssertPtrEquals(tc, u, building_owner(bld));
+    u->number = 0;
+    CuAssertPtrEquals(tc, 0, building_owner(bld));
+    u->number = 1;
+    CuAssertPtrEquals(tc, u, building_owner(bld));
+    test_cleanup();
 }
 
 void test_buildingowner_goes_to_empty_unit_after_leave(CuTest * tc)
 {
-  struct region *r;
-  struct building *bld;
-  struct unit *u1, *u2, *u3;
-  struct faction *f1;
-  const struct building_type *btype;
-  const struct race *human;
+    struct region *r;
+    struct building *bld;
+    struct unit *u1, *u2, *u3;
+    struct faction *f1;
+    const struct building_type *btype;
+    const struct race *human;
 
-  test_cleanup();
-  test_create_world();
+    test_cleanup();
+    test_create_world();
 
-  human = rc_find("human");
-  CuAssertPtrNotNull(tc, human);
+    human = rc_find("human");
+    CuAssertPtrNotNull(tc, human);
 
-  btype = bt_find("castle");
-  CuAssertPtrNotNull(tc, btype);
+    btype = bt_find("castle");
+    CuAssertPtrNotNull(tc, btype);
 
-  f1 = test_create_faction(human);
-  r = findregion(0, 0);
+    f1 = test_create_faction(human);
+    r = findregion(0, 0);
 
-  bld = test_create_building(r, btype);
-  CuAssertPtrNotNull(tc, bld);
+    bld = test_create_building(r, btype);
+    CuAssertPtrNotNull(tc, bld);
 
-  u1 = test_create_unit(f1, r);
-  u2 = test_create_unit(f1, r);
-  u3 = test_create_unit(f1, r);
-  u_set_building(u1, bld);
-  u_set_building(u2, bld);
-  u_set_building(u3, bld);
+    u1 = test_create_unit(f1, r);
+    u2 = test_create_unit(f1, r);
+    u3 = test_create_unit(f1, r);
+    u_set_building(u1, bld);
+    u_set_building(u2, bld);
+    u_set_building(u3, bld);
 
-  CuAssertPtrEquals(tc, u1, building_owner(bld));
-  u2->number = 0;
-  leave_building(u1);
-  CuAssertPtrEquals(tc, u3, building_owner(bld));
-  leave_building(u3);
-  CuAssertPtrEquals(tc, 0, building_owner(bld));
-  u2->number = 1;
-  CuAssertPtrEquals(tc, u2, building_owner(bld));
-  test_cleanup();
+    CuAssertPtrEquals(tc, u1, building_owner(bld));
+    u2->number = 0;
+    leave_building(u1);
+    CuAssertPtrEquals(tc, u3, building_owner(bld));
+    leave_building(u3);
+    CuAssertPtrEquals(tc, 0, building_owner(bld));
+    u2->number = 1;
+    CuAssertPtrEquals(tc, u2, building_owner(bld));
+    test_cleanup();
 }
 
 CuSuite *get_building_suite(void)
 {
-  CuSuite *suite = CuSuiteNew();
-  SUITE_ADD_TEST(suite, test_register_building);
-  SUITE_ADD_TEST(suite, test_building_set_owner);
-  SUITE_ADD_TEST(suite, test_buildingowner_resets_when_empty);
-  SUITE_ADD_TEST(suite, test_buildingowner_goes_to_next_when_empty);
-  SUITE_ADD_TEST(suite, test_buildingowner_goes_to_other_when_empty);
-  SUITE_ADD_TEST(suite, test_buildingowner_goes_to_same_faction_when_empty);
-  SUITE_ADD_TEST(suite, test_buildingowner_goes_to_next_after_leave);
-  SUITE_ADD_TEST(suite, test_buildingowner_goes_to_other_after_leave);
-  SUITE_ADD_TEST(suite, test_buildingowner_goes_to_same_faction_after_leave);
-  SUITE_ADD_TEST(suite, test_buildingowner_goes_to_empty_unit_after_leave);
-  return suite;
+    CuSuite *suite = CuSuiteNew();
+    SUITE_ADD_TEST(suite, test_register_building);
+    SUITE_ADD_TEST(suite, test_building_set_owner);
+    SUITE_ADD_TEST(suite, test_buildingowner_resets_when_empty);
+    SUITE_ADD_TEST(suite, test_buildingowner_goes_to_next_when_empty);
+    SUITE_ADD_TEST(suite, test_buildingowner_goes_to_other_when_empty);
+    SUITE_ADD_TEST(suite, test_buildingowner_goes_to_same_faction_when_empty);
+    SUITE_ADD_TEST(suite, test_buildingowner_goes_to_next_after_leave);
+    SUITE_ADD_TEST(suite, test_buildingowner_goes_to_other_after_leave);
+    SUITE_ADD_TEST(suite, test_buildingowner_goes_to_same_faction_after_leave);
+    SUITE_ADD_TEST(suite, test_buildingowner_goes_to_empty_unit_after_leave);
+    return suite;
 }
diff --git a/src/kernel/calendar.c b/src/kernel/calendar.c
index 59eed21ab..0f4617642 100644
--- a/src/kernel/calendar.c
+++ b/src/kernel/calendar.c
@@ -18,42 +18,42 @@ int seasons = 0;
 
 const gamedate *get_gamedate(int turn, gamedate * gd)
 {
-  int weeks_per_year = months_per_year * weeks_per_month;
-  int t = turn - first_turn;
+    int weeks_per_year = months_per_year * weeks_per_month;
+    int t = turn - first_turn;
 
-  assert(gd);
-  if (t < 0)
-    t = turn;
+    assert(gd);
+    if (t < 0)
+        t = turn;
 
-  gd->week = t % weeks_per_month;       /* 0 - weeks_per_month-1 */
-  gd->month = (t / weeks_per_month + first_month) % months_per_year;    /* 0 - months_per_year-1 */
-  gd->year = t / (weeks_per_year) + 1;
-  gd->season = month_season ? month_season[gd->month] : 0;
-  return gd;
+    gd->week = t % weeks_per_month;       /* 0 - weeks_per_month-1 */
+    gd->month = (t / weeks_per_month + first_month) % months_per_year;    /* 0 - months_per_year-1 */
+    gd->year = t / (weeks_per_year)+1;
+    gd->season = month_season ? month_season[gd->month] : 0;
+    return gd;
 }
 
 void calendar_cleanup(void)
 {
-  int i;
+    int i;
 
-  free(agename);
+    free(agename);
 
-  for (i = 0; i != seasons; ++i) {
-    free(seasonnames[i]);
-  }
-  free(seasonnames);
+    for (i = 0; i != seasons; ++i) {
+        free(seasonnames[i]);
+    }
+    free(seasonnames);
 
-  for (i = 0; i != months_per_year; ++i) {
-    free(monthnames[i]);
-  }
-  free(storms);
-  free(month_season);
-  free(monthnames);
+    for (i = 0; i != months_per_year; ++i) {
+        free(monthnames[i]);
+    }
+    free(storms);
+    free(month_season);
+    free(monthnames);
 
-  for (i = 0; i != weeks_per_month; ++i) {
-    free(weeknames[i]);
-    free(weeknames2[i]);
-  }
-  free(weeknames);
-  free(weeknames2);
+    for (i = 0; i != weeks_per_month; ++i) {
+        free(weeknames[i]);
+        free(weeknames2[i]);
+    }
+    free(weeknames);
+    free(weeknames2);
 }
diff --git a/src/kernel/calendar.h b/src/kernel/calendar.h
index 6085627fa..86f665c1a 100644
--- a/src/kernel/calendar.h
+++ b/src/kernel/calendar.h
@@ -5,38 +5,38 @@
 extern "C" {
 #endif
 
-  enum {
-    SEASON_WINTER,
-    SEASON_SPRING,
-    SEASON_SUMMER,
-    SEASON_AUTUMN
-  };
+    enum {
+        SEASON_WINTER,
+        SEASON_SPRING,
+        SEASON_SUMMER,
+        SEASON_AUTUMN
+    };
 
-  extern char *agename;
-  extern int first_turn;
-  extern int first_month;
+    extern char *agename;
+    extern int first_turn;
+    extern int first_month;
 
-  extern int seasons;
-  extern char **seasonnames;
+    extern int seasons;
+    extern char **seasonnames;
 
-  extern int months_per_year;
-  extern char **monthnames;
-  extern int *month_season;
-  extern int *storms;           /* in movement.c */
+    extern int months_per_year;
+    extern char **monthnames;
+    extern int *month_season;
+    extern int *storms;           /* in movement.c */
 
-  extern char **weeknames;
-  extern char **weeknames2;
-  extern int weeks_per_month;
+    extern char **weeknames;
+    extern char **weeknames2;
+    extern int weeks_per_month;
 
-  typedef struct gamedate {
-    int year;
-    int season;
-    int month;
-    int week;
-  } gamedate;
+    typedef struct gamedate {
+        int year;
+        int season;
+        int month;
+        int week;
+    } gamedate;
 
-  extern const gamedate *get_gamedate(int turn, gamedate * gd);
-  extern void calendar_cleanup(void);
+    extern const gamedate *get_gamedate(int turn, gamedate * gd);
+    extern void calendar_cleanup(void);
 
 #ifdef __cplusplus
 }
diff --git a/src/kernel/command.c b/src/kernel/command.c
index 86681c7c1..ac359a4cf 100644
--- a/src/kernel/command.c
+++ b/src/kernel/command.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/*
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
diff --git a/src/kernel/command.h b/src/kernel/command.h
index 30f02a085..54d8fb25c 100644
--- a/src/kernel/command.h
+++ b/src/kernel/command.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/*
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -6,9 +6,9 @@
  |                   |  Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
  +-------------------+  Stefan Reich <reich@halbling.de>
 
- This program may not be used, modified or distributed 
+ This program may not be used, modified or distributed
  without prior permission by the authors of Eressea.
- 
+
  */
 #ifndef H_UTIL_COMMAND_H
 #define H_UTIL_COMMAND_H
@@ -16,24 +16,24 @@
 extern "C" {
 #endif
 
-  struct locale;
-  struct order;
-  struct unit;
+    struct locale;
+    struct order;
+    struct unit;
 
-  typedef struct syntaxtree {
-    const struct locale *lang;
-    void *root;
-    struct syntaxtree *next;
-  } syntaxtree;
+    typedef struct syntaxtree {
+        const struct locale *lang;
+        void *root;
+        struct syntaxtree *next;
+    } syntaxtree;
 
-  typedef void (*parser) (const void *nodes, struct unit * u, struct order *);
-  extern void add_command(void **troot, void *tnext,
-    const char *str, parser fun);
-  extern void do_command(const void *troot, struct unit *u, struct order *);
+    typedef void(*parser) (const void *nodes, struct unit * u, struct order *);
+    void add_command(void **troot, void *tnext,
+        const char *str, parser fun);
+    void do_command(const void *troot, struct unit *u, struct order *);
 
-  extern struct syntaxtree *stree_create(void);
-  extern void *stree_find(const struct syntaxtree *stree,
-    const struct locale *lang);
+    struct syntaxtree *stree_create(void);
+    void *stree_find(const struct syntaxtree *stree,
+        const struct locale *lang);
 
 #ifdef __cplusplus
 }
diff --git a/src/kernel/config.c b/src/kernel/config.c
index 413f4d253..98c5c5358 100644
--- a/src/kernel/config.c
+++ b/src/kernel/config.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
@@ -144,7 +144,7 @@ bool ExpensiveMigrants(void)
         gamecookie = global.cookie;
         value = get_param_int(global.parameters, "study.expensivemigrants", 0);
     }
-    return value!=0;
+    return value != 0;
 }
 
 /** Specifies automatic alliance modes.
@@ -275,23 +275,23 @@ race_t old_race(const struct race * rc)
 }
 
 helpmode helpmodes[] = {
-        { "all", HELP_ALL }
-        ,
-        { "money", HELP_MONEY }
-        ,
-        { "fight", HELP_FIGHT }
-        ,
-        { "observe", HELP_OBSERVE }
-        ,
-        { "give", HELP_GIVE }
-        ,
-        { "guard", HELP_GUARD }
-        ,
-        { "stealth", HELP_FSTEALTH }
-        ,
-        { "travel", HELP_TRAVEL }
-        ,
-        { NULL, 0 }
+    { "all", HELP_ALL }
+    ,
+    { "money", HELP_MONEY }
+    ,
+    { "fight", HELP_FIGHT }
+    ,
+    { "observe", HELP_OBSERVE }
+    ,
+    { "give", HELP_GIVE }
+    ,
+    { "guard", HELP_GUARD }
+    ,
+    { "stealth", HELP_FSTEALTH }
+    ,
+    { "travel", HELP_TRAVEL }
+    ,
+    { NULL, 0 }
 };
 
 /** Returns the English name of the race, which is what the database uses.
@@ -784,7 +784,7 @@ int getunit(const region * r, const faction * f, unit **uresult)
     if (n == 0) {
         result = GET_PEASANTS;
     }
-    else if (n>0) {
+    else if (n > 0) {
         u2 = findunit(n);
         if (u2 != NULL && u2->region == r) {
             /* there used to be a 'u2->flags & UFL_ISNEW || u2->number>0' condition
@@ -913,7 +913,7 @@ int maxworkingpeasants(const struct region *r)
 {
     int size = production(r);
     int treespace = (rtrees(r, 2) + rtrees(r, 1) / 2) * TREESIZE;
-    return _max(size-treespace, _min(size / 10 , 200));
+    return _max(size - treespace, _min(size / 10, 200));
 }
 
 static const char * parameter_key(int i)
@@ -1291,13 +1291,13 @@ bool has_horses(const struct unit * u)
  * Modifikation f�r St�dter. */
 
 static const int wagetable[7][4] = {
-        { 10, 10, 11, -7 },             /* Baustelle */
-        { 10, 10, 11, -5 },             /* Handelsposten */
-        { 11, 11, 12, -3 },             /* Befestigung */
-        { 12, 11, 13, -1 },             /* Turm */
-        { 13, 12, 14, 0 },              /* Burg */
-        { 14, 12, 15, 1 },              /* Festung */
-        { 15, 13, 16, 2 }               /* Zitadelle */
+    { 10, 10, 11, -7 },             /* Baustelle */
+    { 10, 10, 11, -5 },             /* Handelsposten */
+    { 11, 11, 12, -3 },             /* Befestigung */
+    { 12, 11, 13, -1 },             /* Turm */
+    { 13, 12, 14, 0 },              /* Burg */
+    { 14, 12, 15, 1 },              /* Festung */
+    { 15, 13, 16, 2 }               /* Zitadelle */
 };
 
 int cmp_wage(const struct building *b, const building * a)
diff --git a/src/kernel/config.h b/src/kernel/config.h
index 6f6401e11..444356492 100644
--- a/src/kernel/config.h
+++ b/src/kernel/config.h
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/kernel/config.test.c b/src/kernel/config.test.c
index 34755c13b..ef5792bd0 100644
--- a/src/kernel/config.test.c
+++ b/src/kernel/config.test.c
@@ -41,7 +41,7 @@ static void test_getunit(CuTest *tc) {
     CuAssertPtrEquals(tc, NULL, u2);
     free_order(ord);
 
-    ord = create_order(K_GIVE, lang, itoa36(u->no+1));
+    ord = create_order(K_GIVE, lang, itoa36(u->no + 1));
     init_order(ord);
     CuAssertIntEquals(tc, GET_NOTFOUND, getunit(u->region, u->faction, &u2));
     CuAssertPtrEquals(tc, NULL, u2);
@@ -99,10 +99,10 @@ static void test_param_flt(CuTest * tc)
 
 CuSuite *get_config_suite(void)
 {
-  CuSuite *suite = CuSuiteNew();
-  SUITE_ADD_TEST(suite, test_getunit);
-  SUITE_ADD_TEST(suite, test_get_set_param);
-  SUITE_ADD_TEST(suite, test_param_int);
-  SUITE_ADD_TEST(suite, test_param_flt);
-  return suite;
+    CuSuite *suite = CuSuiteNew();
+    SUITE_ADD_TEST(suite, test_getunit);
+    SUITE_ADD_TEST(suite, test_get_set_param);
+    SUITE_ADD_TEST(suite, test_param_int);
+    SUITE_ADD_TEST(suite, test_param_flt);
+    return suite;
 }
diff --git a/src/kernel/connection.c b/src/kernel/connection.c
index a01c3c826..f21169c71 100644
--- a/src/kernel/connection.c
+++ b/src/kernel/connection.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -47,42 +47,42 @@ int nextborder = 0;
 connection *borders[BORDER_MAXHASH];
 border_type *bordertypes;
 
-void (*border_convert_cb) (struct connection * con, struct attrib * attr) = 0;
+void(*border_convert_cb) (struct connection * con, struct attrib * attr) = 0;
 
 void free_borders(void)
 {
-  int i;
-  for (i = 0; i != BORDER_MAXHASH; ++i) {
-    while (borders[i]) {
-      connection *b = borders[i];
-      borders[i] = b->nexthash;
-      while (b) {
-        connection *bf = b;
-        b = b->next;
-        assert(b == NULL || b->nexthash == NULL);
-        if (bf->type->destroy) {
-          bf->type->destroy(bf);
+    int i;
+    for (i = 0; i != BORDER_MAXHASH; ++i) {
+        while (borders[i]) {
+            connection *b = borders[i];
+            borders[i] = b->nexthash;
+            while (b) {
+                connection *bf = b;
+                b = b->next;
+                assert(b == NULL || b->nexthash == NULL);
+                if (bf->type->destroy) {
+                    bf->type->destroy(bf);
+                }
+                free(bf);
+            }
         }
-        free(bf);
-      }
     }
-  }
 }
 
 connection *find_border(int id)
 {
-  int key;
-  for (key = 0; key != BORDER_MAXHASH; key++) {
-    connection *bhash;
-    for (bhash = borders[key]; bhash != NULL; bhash = bhash->nexthash) {
-      connection *b;
-      for (b = bhash; b; b = b->next) {
-        if (b->id == id)
-          return b;
-      }
+    int key;
+    for (key = 0; key != BORDER_MAXHASH; key++) {
+        connection *bhash;
+        for (bhash = borders[key]; bhash != NULL; bhash = bhash->nexthash) {
+            connection *b;
+            for (b = bhash; b; b = b->next) {
+                if (b->id == id)
+                    return b;
+            }
+        }
     }
-  }
-  return NULL;
+    return NULL;
 }
 
 int resolve_borderid(variant id, void *addr)
@@ -126,205 +126,207 @@ void walk_connections(region *r, void(*cb)(connection *, void *), void *data) {
 
 static connection **get_borders_i(const region * r1, const region * r2)
 {
-  connection **bp;
-  int key = reg_hashkey(r1);
-  int k2 = reg_hashkey(r2);
+    connection **bp;
+    int key = reg_hashkey(r1);
+    int k2 = reg_hashkey(r2);
 
-  key = _min(k2, key) % BORDER_MAXHASH;
-  bp = &borders[key];
-  while (*bp) {
-    connection *b = *bp;
-    if ((b->from == r1 && b->to == r2) || (b->from == r2 && b->to == r1))
-      break;
-    bp = &b->nexthash;
-  }
-  return bp;
+    key = _min(k2, key) % BORDER_MAXHASH;
+    bp = &borders[key];
+    while (*bp) {
+        connection *b = *bp;
+        if ((b->from == r1 && b->to == r2) || (b->from == r2 && b->to == r1))
+            break;
+        bp = &b->nexthash;
+    }
+    return bp;
 }
 
 connection *get_borders(const region * r1, const region * r2)
 {
-  connection **bp = get_borders_i(r1, r2);
-  return *bp;
+    connection **bp = get_borders_i(r1, r2);
+    return *bp;
 }
 
 connection *new_border(border_type * type, region * from, region * to)
 {
-  connection *b = calloc(1, sizeof(struct connection));
+    connection *b = calloc(1, sizeof(struct connection));
 
-  if (from && to) {
-    connection **bp = get_borders_i(from, to);
-    while (*bp)
-      bp = &(*bp)->next;
-    *bp = b;
-  }
-  b->type = type;
-  b->from = from;
-  b->to = to;
-  b->id = ++nextborder;
+    if (from && to) {
+        connection **bp = get_borders_i(from, to);
+        while (*bp)
+            bp = &(*bp)->next;
+        *bp = b;
+    }
+    b->type = type;
+    b->from = from;
+    b->to = to;
+    b->id = ++nextborder;
 
-  if (type->init)
-    type->init(b);
-  return b;
+    if (type->init)
+        type->init(b);
+    return b;
 }
 
 void erase_border(connection * b)
 {
-  if (b->from && b->to) {
-    connection **bp = get_borders_i(b->from, b->to);
-    assert(*bp != NULL || !"error: connection is not registered");
-    if (*bp == b) {
-      /* it is the first in the list, so it is in the nexthash list */
-      if (b->next) {
-        *bp = b->next;
-        (*bp)->nexthash = b->nexthash;
-      } else {
-        *bp = b->nexthash;
-      }
-    } else {
-      while (*bp && *bp != b) {
-        bp = &(*bp)->next;
-      }
-      assert(*bp == b || !"error: connection is not registered");
-      *bp = b->next;
+    if (b->from && b->to) {
+        connection **bp = get_borders_i(b->from, b->to);
+        assert(*bp != NULL || !"error: connection is not registered");
+        if (*bp == b) {
+            /* it is the first in the list, so it is in the nexthash list */
+            if (b->next) {
+                *bp = b->next;
+                (*bp)->nexthash = b->nexthash;
+            }
+            else {
+                *bp = b->nexthash;
+            }
+        }
+        else {
+            while (*bp && *bp != b) {
+                bp = &(*bp)->next;
+            }
+            assert(*bp == b || !"error: connection is not registered");
+            *bp = b->next;
+        }
     }
-  }
-  if (b->type->destroy) {
-    b->type->destroy(b);
-  }
-  free(b);
+    if (b->type->destroy) {
+        b->type->destroy(b);
+    }
+    free(b);
 }
 
 void register_bordertype(border_type * type)
 {
-  border_type **btp = &bordertypes;
+    border_type **btp = &bordertypes;
 
-  while (*btp && *btp != type)
-    btp = &(*btp)->next;
-  if (*btp)
-    return;
-  *btp = type;
+    while (*btp && *btp != type)
+        btp = &(*btp)->next;
+    if (*btp)
+        return;
+    *btp = type;
 }
 
 border_type *find_bordertype(const char *name)
 {
-  border_type *bt = bordertypes;
+    border_type *bt = bordertypes;
 
-  while (bt && strcmp(bt->__name, name))
-    bt = bt->next;
-  return bt;
+    while (bt && strcmp(bt->__name, name))
+        bt = bt->next;
+    return bt;
 }
 
 void b_read(connection * b, storage * store)
 {
-  int n, result = 0;
-  switch (b->type->datatype) {
+    int n, result = 0;
+    switch (b->type->datatype) {
     case VAR_NONE:
     case VAR_INT:
-      READ_INT(store, &b->data.i);
-      break;
+        READ_INT(store, &b->data.i);
+        break;
     case VAR_SHORTA:
-      READ_INT(store, &n);
-      b->data.sa[0] = (short)n;
-      READ_INT(store, &n);
-      b->data.sa[1] = (short)n;
-      break;
+        READ_INT(store, &n);
+        b->data.sa[0] = (short)n;
+        READ_INT(store, &n);
+        b->data.sa[1] = (short)n;
+        break;
     case VAR_VOIDPTR:
     default:
-      assert(!"invalid variant type in connection");
-      result = 0;
-  }
-  assert(result >= 0 || "EOF encountered?");
+        assert(!"invalid variant type in connection");
+        result = 0;
+    }
+    assert(result >= 0 || "EOF encountered?");
 }
 
 void b_write(const connection * b, storage * store)
 {
-  switch (b->type->datatype) {
+    switch (b->type->datatype) {
     case VAR_NONE:
     case VAR_INT:
-      WRITE_INT(store, b->data.i);
-      break;
+        WRITE_INT(store, b->data.i);
+        break;
     case VAR_SHORTA:
-      WRITE_INT(store, b->data.sa[0]);
-      WRITE_INT(store, b->data.sa[1]);
-      break;
+        WRITE_INT(store, b->data.sa[0]);
+        WRITE_INT(store, b->data.sa[1]);
+        break;
     case VAR_VOIDPTR:
     default:
-      assert(!"invalid variant type in connection");
-  }
+        assert(!"invalid variant type in connection");
+    }
 }
 
 bool b_transparent(const connection * b, const struct faction *f)
 {
-  unused_arg(b);
-  unused_arg(f);
-  return true;
+    unused_arg(b);
+    unused_arg(f);
+    return true;
 }
 
 bool b_opaque(const connection * b, const struct faction * f)
 {
-  unused_arg(b);
-  unused_arg(f);
-  return false;
+    unused_arg(b);
+    unused_arg(f);
+    return false;
 }
 
 bool b_blockall(const connection * b, const unit * u, const region * r)
 {
-  unused_arg(u);
-  unused_arg(r);
-  unused_arg(b);
-  return true;
+    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;
+    unused_arg(u);
+    unused_arg(r);
+    unused_arg(b);
+    return false;
 }
 
 bool b_rvisible(const connection * b, const region * r)
 {
-  return (bool) (b->to == r || b->from == r);
+    return (bool)(b->to == r || b->from == r);
 }
 
 bool b_fvisible(const connection * b, const struct faction * f,
-  const region * r)
+    const region * r)
 {
-  unused_arg(r);
-  unused_arg(f);
-  unused_arg(b);
-  return true;
+    unused_arg(r);
+    unused_arg(f);
+    unused_arg(b);
+    return true;
 }
 
 bool b_uvisible(const connection * b, const unit * u)
 {
-  unused_arg(u);
-  unused_arg(b);
-  return true;
+    unused_arg(u);
+    unused_arg(b);
+    return true;
 }
 
 bool b_rinvisible(const connection * b, const region * r)
 {
-  unused_arg(r);
-  unused_arg(b);
-  return false;
+    unused_arg(r);
+    unused_arg(b);
+    return false;
 }
 
 bool b_finvisible(const connection * b, const struct faction * f,
-  const region * r)
+    const region * r)
 {
-  unused_arg(r);
-  unused_arg(f);
-  unused_arg(b);
-  return false;
+    unused_arg(r);
+    unused_arg(f);
+    unused_arg(b);
+    return false;
 }
 
 bool b_uinvisible(const connection * b, const unit * u)
 {
-  unused_arg(u);
-  unused_arg(b);
-  return false;
+    unused_arg(u);
+    unused_arg(b);
+    return false;
 }
 
 /**************************************/
@@ -332,37 +334,37 @@ bool b_uinvisible(const connection * b, const unit * u)
 /**************************************/
 
 attrib_type at_countdown = {
-  "countdown",
-  DEFAULT_INIT,
-  DEFAULT_FINALIZE,
-  NULL,
-  NULL,
-  a_readint
+    "countdown",
+    DEFAULT_INIT,
+    DEFAULT_FINALIZE,
+    NULL,
+    NULL,
+    a_readint
 };
 
 void age_borders(void)
 {
-  quicklist *deleted = NULL, *ql;
-  int i;
+    quicklist *deleted = NULL, *ql;
+    int i;
 
-  for (i = 0; i != BORDER_MAXHASH; ++i) {
-    connection *bhash = borders[i];
-    for (; bhash; bhash = bhash->nexthash) {
-      connection *b = bhash;
-      for (; b; b = b->next) {
-        if (b->type->age) {
-          if (b->type->age(b) == AT_AGE_REMOVE) {
-            ql_push(&deleted, b);
-          }
+    for (i = 0; i != BORDER_MAXHASH; ++i) {
+        connection *bhash = borders[i];
+        for (; bhash; bhash = bhash->nexthash) {
+            connection *b = bhash;
+            for (; b; b = b->next) {
+                if (b->type->age) {
+                    if (b->type->age(b) == AT_AGE_REMOVE) {
+                        ql_push(&deleted, b);
+                    }
+                }
+            }
         }
-      }
     }
-  }
-  for (ql = deleted, i = 0; ql; ql_advance(&ql, &i, 1)) {
-    connection *b = (connection *) ql_get(ql, i);
-    erase_border(b);
-  }
-  ql_free(deleted);
+    for (ql = deleted, i = 0; ql; ql_advance(&ql, &i, 1)) {
+        connection *b = (connection *)ql_get(ql, i);
+        erase_border(b);
+    }
+    ql_free(deleted);
 }
 
 /********
@@ -373,114 +375,114 @@ void age_borders(void)
 #include "faction.h"
 
 static const char *b_namewall(const connection * b, const region * r,
-  const struct faction *f, int gflags)
+    const struct faction *f, int gflags)
 {
-  const char *bname = "wall";
+    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));
+    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));
 }
 
 border_type bt_wall = {
-  "wall", VAR_INT,
-  b_opaque,
-  NULL,                         /* init */
-  NULL,                         /* destroy */
-  b_read,                       /* read */
-  b_write,                      /* write */
-  b_blockall,                   /* block */
-  b_namewall,                   /* name */
-  b_rvisible,                   /* rvisible */
-  b_fvisible,                   /* fvisible */
-  b_uvisible,                   /* uvisible */
+    "wall", VAR_INT,
+    b_opaque,
+    NULL,                         /* init */
+    NULL,                         /* destroy */
+    b_read,                       /* read */
+    b_write,                      /* write */
+    b_blockall,                   /* block */
+    b_namewall,                   /* name */
+    b_rvisible,                   /* rvisible */
+    b_fvisible,                   /* fvisible */
+    b_uvisible,                   /* uvisible */
 };
 
 border_type bt_noway = {
-  "noway", VAR_INT,
-  b_transparent,
-  NULL,                         /* init */
-  NULL,                         /* destroy */
-  b_read,                       /* read */
-  b_write,                      /* write */
-  b_blockall,                   /* block */
-  NULL,                         /* name */
-  b_rinvisible,                 /* rvisible */
-  b_finvisible,                 /* fvisible */
-  b_uinvisible,                 /* uvisible */
+    "noway", VAR_INT,
+    b_transparent,
+    NULL,                         /* init */
+    NULL,                         /* destroy */
+    b_read,                       /* read */
+    b_write,                      /* write */
+    b_blockall,                   /* block */
+    NULL,                         /* name */
+    b_rinvisible,                 /* rvisible */
+    b_finvisible,                 /* fvisible */
+    b_uinvisible,                 /* uvisible */
 };
 
 static const char *b_namefogwall(const connection * b, const region * r,
-  const struct faction *f, int gflags)
+    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"));
+    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 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 */
+    unused_arg(b);
+    unused_arg(r);
+    if (!u)
+        return true;
+    return (bool)(effskill(u, SK_PERCEPTION) > 4);    /* Das ist die alte Nebelwand */
 }
 
 /** Legacy type used in old Eressea games, no longer in use. */
 border_type bt_fogwall = {
-  "fogwall", VAR_INT,
-  b_transparent,                /* transparent */
-  NULL,                         /* init */
-  NULL,                         /* destroy */
-  b_read,                       /* read */
-  b_write,                      /* write */
-  b_blockfogwall,               /* block */
-  b_namefogwall,                /* name */
-  b_rvisible,                   /* rvisible */
-  b_fvisible,                   /* fvisible */
-  b_uvisible,                   /* uvisible */
+    "fogwall", VAR_INT,
+    b_transparent,                /* transparent */
+    NULL,                         /* init */
+    NULL,                         /* destroy */
+    b_read,                       /* read */
+    b_write,                      /* write */
+    b_blockfogwall,               /* block */
+    b_namefogwall,                /* name */
+    b_rvisible,                   /* rvisible */
+    b_fvisible,                   /* fvisible */
+    b_uvisible,                   /* uvisible */
 };
 
 static const char *b_nameillusionwall(const connection * b, const region * r,
-  const struct faction *f, int gflags)
+    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) {
+    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->subscription) ? "an_illusionwall" : "a_wall"));
-  }
-  return LOC(f->locale, mkname("border", (f
         && fno == f->no) ? "illusionwall" : "wall"));
 }
 
 border_type bt_illusionwall = {
-  "illusionwall", VAR_INT,
-  b_opaque,
-  NULL,                         /* init */
-  NULL,                         /* destroy */
-  b_read,                       /* read */
-  b_write,                      /* write */
-  b_blocknone,                  /* block */
-  b_nameillusionwall,           /* name */
-  b_rvisible,                   /* rvisible */
-  b_fvisible,                   /* fvisible */
-  b_uvisible,                   /* uvisible */
+    "illusionwall", VAR_INT,
+    b_opaque,
+    NULL,                         /* init */
+    NULL,                         /* destroy */
+    b_read,                       /* read */
+    b_write,                      /* write */
+    b_blocknone,                  /* block */
+    b_nameillusionwall,           /* name */
+    b_rvisible,                   /* rvisible */
+    b_fvisible,                   /* fvisible */
+    b_uvisible,                   /* uvisible */
 };
 
 /***
@@ -488,176 +490,181 @@ border_type bt_illusionwall = {
  ***/
 
 static const char *b_nameroad(const connection * b, const region * r,
-  const struct faction *f, int gflags)
+    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];
+    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"));
-      }
+    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;
+    else if (gflags & GF_PLURAL)
+        return LOC(f->locale, mkname("border", "roads"));
+    else
+        return LOC(f->locale, mkname("border", "road"));
+    return buffer;
 }
 
 static void b_readroad(connection * b, storage * store)
 {
-  int n;
-  READ_INT(store, &n);
-  b->data.sa[0] = (short)n;
-  READ_INT(store, &n);
-  b->data.sa[1] = (short)n;
+    int n;
+    READ_INT(store, &n);
+    b->data.sa[0] = (short)n;
+    READ_INT(store, &n);
+    b->data.sa[1] = (short)n;
 }
 
 static void b_writeroad(const connection * b, storage * store)
 {
-  WRITE_INT(store, b->data.sa[0]);
-  WRITE_INT(store, b->data.sa[1]);
+    WRITE_INT(store, b->data.sa[0]);
+    WRITE_INT(store, b->data.sa[1]);
 }
 
 static bool b_validroad(const connection * b)
 {
-  return (b->data.sa[0] != SHRT_MAX);
+    return (b->data.sa[0] != SHRT_MAX);
 }
 
 static bool b_rvisibleroad(const connection * b, const region * r)
 {
-  int x = b->data.i;
-  x = (r == b->from) ? b->data.sa[0] : b->data.sa[1];
-  if (x == 0) {
-    return false;
-  }
-  if (b->to != r && b->from != r) {
-    return false;
-  }
-  return true;
+    int x = b->data.i;
+    x = (r == b->from) ? b->data.sa[0] : b->data.sa[1];
+    if (x == 0) {
+        return false;
+    }
+    if (b->to != r && b->from != r) {
+        return false;
+    }
+    return true;
 }
 
 border_type bt_road = {
-  "road", VAR_INT,
-  b_transparent,
-  NULL,                         /* init */
-  NULL,                         /* destroy */
-  b_readroad,                   /* read */
-  b_writeroad,                  /* write */
-  b_blocknone,                  /* block */
-  b_nameroad,                   /* name */
-  b_rvisibleroad,               /* rvisible */
-  b_finvisible,                 /* fvisible */
-  b_uinvisible,                 /* uvisible */
-  b_validroad                   /* valid */
+    "road", VAR_INT,
+    b_transparent,
+    NULL,                         /* init */
+    NULL,                         /* destroy */
+    b_readroad,                   /* read */
+    b_writeroad,                  /* write */
+    b_blocknone,                  /* block */
+    b_nameroad,                   /* name */
+    b_rvisibleroad,               /* rvisible */
+    b_finvisible,                 /* fvisible */
+    b_uinvisible,                 /* uvisible */
+    b_validroad                   /* valid */
 };
 
 void write_borders(struct storage *store)
 {
-  int i;
-  for (i = 0; i != BORDER_MAXHASH; ++i) {
-    connection *bhash;
-    for (bhash = borders[i]; bhash; bhash = bhash->nexthash) {
-      connection *b;
-      for (b = bhash; b != NULL; b = b->next) {
-        if (b->type->valid && !b->type->valid(b))
-          continue;
-        WRITE_TOK(store, b->type->__name);
-        WRITE_INT(store, b->id);
-        WRITE_INT(store, b->from->uid);
-        WRITE_INT(store, b->to->uid);
+    int i;
+    for (i = 0; i != BORDER_MAXHASH; ++i) {
+        connection *bhash;
+        for (bhash = borders[i]; bhash; bhash = bhash->nexthash) {
+            connection *b;
+            for (b = bhash; b != NULL; b = b->next) {
+                if (b->type->valid && !b->type->valid(b))
+                    continue;
+                WRITE_TOK(store, b->type->__name);
+                WRITE_INT(store, b->id);
+                WRITE_INT(store, b->from->uid);
+                WRITE_INT(store, b->to->uid);
 
-        if (b->type->write)
-          b->type->write(b, store);
-        WRITE_SECTION(store);
-      }
+                if (b->type->write)
+                    b->type->write(b, store);
+                WRITE_SECTION(store);
+            }
+        }
     }
-  }
-  WRITE_TOK(store, "end");
+    WRITE_TOK(store, "end");
 }
 
 int read_borders(struct storage *store)
 {
-  for (;;) {
-    int bid = 0;
-    char zText[32];
-    connection *b;
-    region *from, *to;
-    border_type *type;
+    for (;;) {
+        int bid = 0;
+        char zText[32];
+        connection *b;
+        region *from, *to;
+        border_type *type;
 
-    READ_TOK(store, zText, sizeof(zText));
-    if (!strcmp(zText, "end"))
-      break;
-    READ_INT(store, &bid);
-    if (global.data_version < UIDHASH_VERSION) {
-      int fx, fy, tx, ty;
-      READ_INT(store, &fx);
-      READ_INT(store, &fy);
-      READ_INT(store, &tx);
-      READ_INT(store, &ty);
-      from = findregion(fx, fy);
-      to = findregion(tx, ty);
-    } else {
-      int fid, tid;
-      READ_INT(store, &fid);
-      READ_INT(store, &tid);
-      from = findregionbyid(fid);
-      to = findregionbyid(tid);
-    }
+        READ_TOK(store, zText, sizeof(zText));
+        if (!strcmp(zText, "end"))
+            break;
+        READ_INT(store, &bid);
+        if (global.data_version < UIDHASH_VERSION) {
+            int fx, fy, tx, ty;
+            READ_INT(store, &fx);
+            READ_INT(store, &fy);
+            READ_INT(store, &tx);
+            READ_INT(store, &ty);
+            from = findregion(fx, fy);
+            to = findregion(tx, ty);
+        }
+        else {
+            int fid, tid;
+            READ_INT(store, &fid);
+            READ_INT(store, &tid);
+            from = findregionbyid(fid);
+            to = findregionbyid(tid);
+        }
 
-    type = find_bordertype(zText);
-    if (type == NULL) {
-      log_error("[read_borders] unknown connection type '%s' in %s\n", zText, regionname(from, NULL));
-      assert(type || !"connection type not registered");
-    }
+        type = find_bordertype(zText);
+        if (type == NULL) {
+            log_error("[read_borders] unknown connection type '%s' in %s\n", zText, regionname(from, NULL));
+            assert(type || !"connection type not registered");
+        }
 
-    if (to == from && type && from) {
-      direction_t dir = (direction_t) (rng_int() % MAXDIRECTIONS);
-      region *r = rconnect(from, dir);
-      log_error("[read_borders] invalid %s in %s\n", type->__name, regionname(from, NULL));
-      if (r != NULL)
-        to = r;
+        if (to == from && type && from) {
+            direction_t dir = (direction_t)(rng_int() % MAXDIRECTIONS);
+            region *r = rconnect(from, dir);
+            log_error("[read_borders] invalid %s in %s\n", type->__name, regionname(from, NULL));
+            if (r != NULL)
+                to = r;
+        }
+        b = new_border(type, from, to);
+        nextborder--;               /* new_border erh�ht den Wert */
+        b->id = bid;
+        assert(bid <= nextborder);
+        if (type->read)
+            type->read(b, store);
+        if (global.data_version < NOBORDERATTRIBS_VERSION) {
+            attrib *a = NULL;
+            int result = a_read(store, &a, b);
+            if (border_convert_cb)
+                border_convert_cb(b, a);
+            while (a) {
+                a_remove(&a, a);
+            }
+            if (result < 0)
+                return result;
+        }
+        if ((type->read && !type->write) || !to || !from) {
+            log_warning("erase invalid border '%s' between '%s' and '%s'\n", type->__name, regionname(from, 0), regionname(to, 0));
+            erase_border(b);
+        }
     }
-    b = new_border(type, from, to);
-    nextborder--;               /* new_border erh�ht den Wert */
-    b->id = bid;
-    assert(bid <= nextborder);
-    if (type->read)
-      type->read(b, store);
-    if (global.data_version < NOBORDERATTRIBS_VERSION) {
-      attrib *a = NULL;
-      int result = a_read(store, &a, b);
-      if (border_convert_cb)
-        border_convert_cb(b, a);
-      while (a) {
-        a_remove(&a, a);
-      }
-      if (result < 0)
-        return result;
-    }
-    if ((type->read && !type->write) || !to || !from) {
-      log_warning("erase invalid border '%s' between '%s' and '%s'\n", type->__name, regionname(from, 0), regionname(to, 0));
-      erase_border(b);
-    }
-  }
-  return 0;
+    return 0;
 }
diff --git a/src/kernel/connection.h b/src/kernel/connection.h
index dd168b413..334a9223e 100644
--- a/src/kernel/connection.h
+++ b/src/kernel/connection.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -31,122 +31,121 @@ extern "C" {
     struct region;
     struct storage;
     struct unit;
-    
-  extern int nextborder;
 
-  typedef struct connection {
-    struct border_type *type;   /* the type of this connection */
-    struct connection *next;    /* next connection between these regions */
-    struct connection *nexthash;        /* next connection between these regions */
-    struct region *from, *to;   /* borders can be directed edges */
-    variant data;
-    int id;            /* unique id */
-  } connection;
+    extern int nextborder;
 
-  typedef struct border_type {
-    const char *__name;         /* internal use only */
-    variant_type datatype;
-     bool(*transparent) (const connection *, const struct faction *);
-    /* is it possible to see through this? */
-    void (*init) (connection *);
-    /* constructor: initialize the connection. allocate extra memory if needed */
-    void (*destroy) (connection *);
-    /* destructor: remove all extra memory for destruction */
-    void (*read) (connection *, struct storage *);
-    void (*write) (const connection *, struct storage *);
-     bool(*block) (const connection *, const struct unit *,
-      const struct region * r);
-    /* return true if it blocks movement of u from
-     * r to the opposite struct region.
-     * warning: struct unit may be NULL.
-     */
-    const char *(*name) (const connection * b, const struct region * r,
-      const struct faction * f, int gflags);
-    /* for example "a wall of fog" or "a doorway from r1 to r2"
-     * may depend on the struct faction, for example "a wall" may
-     * turn out to be "an illusionary wall"
-     */
-     bool(*rvisible) (const connection *, const struct region *);
-    /* is it visible to everyone in r ?
-     * if not, it may still be fvisible() for some f.
-     */
-     bool(*fvisible) (const connection *, const struct faction *,
-      const struct region *);
-    /* is it visible to units of f in r?
-     * the function shall not check for
-     * existence of a struct unit in r. Example: a spell
-     * may be visible only to the struct faction that created it and thus
-     * appear in it's report (if there is a struct unit of f in r, which
-     * the reporting function will have to assure).
-     * if not true, it may still be uvisible() for some u.
-     */
-     bool(*uvisible) (const connection *, const struct unit *);
-    /* is it visible to u ?
-     * a doorway may only be visible to a struct unit with perception > 5
-     */
-     bool(*valid) (const connection *);
-    /* is the connection in a valid state,
-     * or should it be erased at the end of this turn to save space?
-     */
-    struct region *(*move) (const connection *, struct unit * u,
-      struct region * from, struct region * to, bool routing);
-    /* executed when the units traverses this connection */
-    int (*age) (struct connection *);
-    /* return 0 if connection needs to be removed. >0 if still aging, <0 if not aging */
-    struct border_type *next;   /* for internal use only */
-  } border_type;
+    typedef struct connection {
+        struct border_type *type;   /* the type of this connection */
+        struct connection *next;    /* next connection between these regions */
+        struct connection *nexthash;        /* next connection between these regions */
+        struct region *from, *to;   /* borders can be directed edges */
+        variant data;
+        int id;            /* unique id */
+    } connection;
 
-  extern connection *find_border(int id);
-  int resolve_borderid(variant data, void *addr);
-  extern void free_borders(void);
+    typedef struct border_type {
+        const char *__name;         /* internal use only */
+        variant_type datatype;
+        bool(*transparent) (const connection *, const struct faction *);
+        /* is it possible to see through this? */
+        void(*init) (connection *);
+        /* constructor: initialize the connection. allocate extra memory if needed */
+        void(*destroy) (connection *);
+        /* destructor: remove all extra memory for destruction */
+        void(*read) (connection *, struct storage *);
+        void(*write) (const connection *, struct storage *);
+        bool(*block) (const connection *, const struct unit *,
+            const struct region * r);
+        /* return true if it blocks movement of u from
+         * r to the opposite struct region.
+         * warning: struct unit may be NULL.
+         */
+        const char *(*name) (const connection * b, const struct region * r,
+            const struct faction * f, int gflags);
+        /* for example "a wall of fog" or "a doorway from r1 to r2"
+         * may depend on the struct faction, for example "a wall" may
+         * turn out to be "an illusionary wall"
+         */
+        bool(*rvisible) (const connection *, const struct region *);
+        /* is it visible to everyone in r ?
+         * if not, it may still be fvisible() for some f.
+         */
+        bool(*fvisible) (const connection *, const struct faction *,
+            const struct region *);
+        /* is it visible to units of f in r?
+         * the function shall not check for
+         * existence of a struct unit in r. Example: a spell
+         * may be visible only to the struct faction that created it and thus
+         * appear in it's report (if there is a struct unit of f in r, which
+         * the reporting function will have to assure).
+         * if not true, it may still be uvisible() for some u.
+         */
+        bool(*uvisible) (const connection *, const struct unit *);
+        /* is it visible to u ?
+         * a doorway may only be visible to a struct unit with perception > 5
+         */
+        bool(*valid) (const connection *);
+        /* is the connection in a valid state,
+         * or should it be erased at the end of this turn to save space?
+         */
+        struct region *(*move) (const connection *, struct unit * u,
+        struct region * from, struct region * to, bool routing);
+        /* executed when the units traverses this connection */
+        int(*age) (struct connection *);
+        /* return 0 if connection needs to be removed. >0 if still aging, <0 if not aging */
+        struct border_type *next;   /* for internal use only */
+    } border_type;
 
-  void walk_connections(struct region *r, void(*cb)(struct connection *, void *), void *data);
-  connection *get_borders(const struct region *r1,
-    const struct region *r2);
-  /* returns the list of borders between r1 and r2 or r2 and r1 */
-  extern connection *new_border(border_type * type, struct region *from,
+    connection *find_border(int id);
+    int resolve_borderid(variant data, void *addr);
+    void free_borders(void);
+
+    void walk_connections(struct region *r, void(*cb)(struct connection *, void *), void *data);
+    connection *get_borders(const struct region *r1,
+        const struct region *r2);
+    /* returns the list of borders between r1 and r2 or r2 and r1 */
+    connection *new_border(border_type * type, struct region *from,
     struct region *to);
-  /* creates a connection of the specified type */
-  extern void erase_border(connection * b);
-  /* remove the connection from memory */
-  extern border_type *find_bordertype(const char *name);
-  extern void register_bordertype(border_type * type);
-  /* register a new bordertype */
+    /* creates a connection of the specified type */
+    void erase_border(connection * b);
+    /* remove the connection from memory */
+    border_type *find_bordertype(const char *name);
+    void register_bordertype(border_type * type);
+    /* register a new bordertype */
 
-  extern int read_borders(struct storage *store);
-  extern void write_borders(struct storage *store);
-  extern void age_borders(void);
+    int read_borders(struct storage *store);
+    void write_borders(struct storage *store);
+    void age_borders(void);
 
-  /* provide default implementations for some member functions: */
-  extern void b_read(connection * b, struct storage *store);
-  extern void b_write(const connection * b, struct storage *store);
-  extern bool b_blockall(const connection *, const struct unit *,
-    const struct region *);
-  extern bool b_blocknone(const connection *, const struct unit *,
-    const struct region *);
-  extern bool b_rvisible(const connection *, const struct region *r);
-  extern bool b_fvisible(const connection *, const struct faction *f,
-    const struct region *);
-  extern bool b_uvisible(const connection *, const struct unit *u);
-  extern bool b_rinvisible(const connection *, const struct region *r);
-  extern bool b_finvisible(const connection *, const struct faction *f,
-    const struct region *);
-  extern bool b_uinvisible(const connection *, const struct unit *u);
-  extern bool b_transparent(const connection *, const struct faction *);
-  extern bool b_opaque(const connection *, const struct faction *);  /* !transparent */
+    /* provide default implementations for some member functions: */
+    void b_read(connection * b, struct storage *store);
+    void b_write(const connection * b, struct storage *store);
+    bool b_blockall(const connection *, const struct unit *,
+        const struct region *);
+    bool b_blocknone(const connection *, const struct unit *,
+        const struct region *);
+    bool b_rvisible(const connection *, const struct region *r);
+    bool b_fvisible(const connection *, const struct faction *f,
+        const struct region *);
+    bool b_uvisible(const connection *, const struct unit *u);
+    bool b_rinvisible(const connection *, const struct region *r);
+    bool b_finvisible(const connection *, const struct faction *f,
+        const struct region *);
+    bool b_uinvisible(const connection *, const struct unit *u);
+    bool b_transparent(const connection *, const struct faction *);
+    bool b_opaque(const connection *, const struct faction *);  /* !transparent */
 
-  extern border_type bt_fogwall;
-  extern border_type bt_noway;
-  extern border_type bt_wall;
-  extern border_type bt_illusionwall;
-  extern border_type bt_road;
-  extern border_type bt_questportal;
+    extern border_type bt_fogwall;
+    extern border_type bt_noway;
+    extern border_type bt_wall;
+    extern border_type bt_illusionwall;
+    extern border_type bt_road;
+    extern border_type bt_questportal;
 
-  extern struct attrib_type at_countdown;
+    extern struct attrib_type at_countdown;
 
-  /* game-specific callbacks */
-  extern void (*border_convert_cb) (struct connection * con,
-    struct attrib * attr);
+    /* game-specific callbacks */
+    void(*border_convert_cb) (struct connection * con, struct attrib * attr);
 
 #ifdef __cplusplus
 }
diff --git a/src/kernel/curse.c b/src/kernel/curse.c
index 9aa8897b9..f8e5cfe9c 100644
--- a/src/kernel/curse.c
+++ b/src/kernel/curse.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2014, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
@@ -150,9 +150,9 @@ static int read_ccompat(const char *cursename, struct storage *store)
         const char *name;
         const char *tokens;
     } *seek, old_curses[] = { {
-        "disorientationzone", "" }, {
-            "shipdisorientation", "" }, {
-                NULL, NULL } };
+            "disorientationzone", "" }, {
+                "shipdisorientation", "" }, {
+                    NULL, NULL } };
     for (seek = old_curses; seek->name; ++seek) {
         if (strcmp(seek->tokens, cursename) == 0) {
             const char *p;
diff --git a/src/kernel/curse.h b/src/kernel/curse.h
index 7bc6f9652..d8cee0aa8 100644
--- a/src/kernel/curse.h
+++ b/src/kernel/curse.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2014, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -26,153 +26,153 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-/* Sprueche in der struct region und auf Einheiten, Schiffen oder Burgen
- * (struct attribute)
- */
+    /* Sprueche in der struct region und auf Einheiten, Schiffen oder Burgen
+     * (struct attribute)
+     */
 
-/* Brainstorming �berarbeitung curse
- *
- * Ziel: Keine Enum-Liste, flexible, leicht erweiterbare Curse-Objekte
- *
- * Was wird gebraucht?
- * - Eindeutige Kennung f�r globale Suche
- * - eine Wirkung, die sich einfach 'anwenden' l��t, dabei flexibel ist,
- *   Raum l��t f�r variable Boni, Anzahl betroffener Personen,
- *   spezielle Effekte oder anderes
- * - einfacher Zugriff auf allgemeine Funktionen wie zb Alterung, aber
- *   auch Antimagieverhalten
- * - Ausgabe von Beschreibungen in verschiedenen Sprachen
- * - definiertes gekapseltes Verhalten zb bei Zusammenlegung von
- *   Einheiten, �bergabe von Personen, Mehrfachverzauberung
- * - (R�ck-)Referenzen auf Objekt, Verursacher (Magier), ?
- *
- * Vieleicht w�re ein Wirkungsklassensystem sinnvoll, so das im �brigen
- * source einfach alle curse-attribs abgefragt werden k�nnen und bei
- * gew�nschter Wirkungsklasse angewendet, also nicht f�r jeden curse
- * spezielle �nderungen im �brigen source notwendig sind.
- *
- * Die (Wirkungs-)Typen sollten die wichtigen Funktionen speziell
- * belegen k�nnen, zb Alterung, Ausgabetexte, Merge-Verhalten
- *
- * Was sind wichtige individuelle Eigenschaften?
- * - Referenzen auf Objekt und Verursacher
- * - Referenzen f�r globale Liste
- * > die Wirkung:
- * - Dauer
- * - Widerstandskraft, zb gegen Antimagie
- * - Seiteneffekte zb Flag ONLYONE, Unvertr�glichkeiten
- * - Alterungsverhalten zb Flag NOAGE
- * - Effektverhalten, zb Bonus (variabel)
- * - bei Einheitenzaubern die Zahl der betroffenen Personen
- *
- * Dabei sind nur die beiden letzten Punkte wirklich reine individuelle
- * Wirkung, die anderen sind eher allgemeine Kennzeichen eines jeden
- * Curse, die individuell belegt sind.
- * ONLYONE und NOAGE k�nnten auch Eigenschaften des Typs sein, nicht des
- * individuellen curse. Allgemein ist Alterung wohl eher eine
- * Typeigenschaft als die eines individuellen curse.
- * Dagegen ist der Widerstand gegen Antimagie sowohl abh�ngig von der
- * G�te des Verursachers, also des Magiers zum Zeitpunkt des Zaubers,
- * als auch vom Typ, der gegen bestimmte Arten des 'Fluchbrechens' immun
- * sein k�nnte.
- *
- * Was sind wichtige Typeigenschaften?
- * - Verhalten bei Personen�bergaben
- * - allgemeine Wirkung
- * - Beschreibungstexte
- * - Verhalten bei Antimagie
- * - Alterung
- * - Speicherung des C-Objekts
- * - Laden des C-Objekts
- * - Erzeugen des C-Objekts
- * - L�schen und Aufr�umen des C-Objekts
- * - Funktionen zur �nderung der Werte
- *
- * */
+    /* Brainstorming �berarbeitung curse
+     *
+     * Ziel: Keine Enum-Liste, flexible, leicht erweiterbare Curse-Objekte
+     *
+     * Was wird gebraucht?
+     * - Eindeutige Kennung f�r globale Suche
+     * - eine Wirkung, die sich einfach 'anwenden' l��t, dabei flexibel ist,
+     *   Raum l��t f�r variable Boni, Anzahl betroffener Personen,
+     *   spezielle Effekte oder anderes
+     * - einfacher Zugriff auf allgemeine Funktionen wie zb Alterung, aber
+     *   auch Antimagieverhalten
+     * - Ausgabe von Beschreibungen in verschiedenen Sprachen
+     * - definiertes gekapseltes Verhalten zb bei Zusammenlegung von
+     *   Einheiten, �bergabe von Personen, Mehrfachverzauberung
+     * - (R�ck-)Referenzen auf Objekt, Verursacher (Magier), ?
+     *
+     * Vieleicht w�re ein Wirkungsklassensystem sinnvoll, so das im �brigen
+     * source einfach alle curse-attribs abgefragt werden k�nnen und bei
+     * gew�nschter Wirkungsklasse angewendet, also nicht f�r jeden curse
+     * spezielle �nderungen im �brigen source notwendig sind.
+     *
+     * Die (Wirkungs-)Typen sollten die wichtigen Funktionen speziell
+     * belegen k�nnen, zb Alterung, Ausgabetexte, Merge-Verhalten
+     *
+     * Was sind wichtige individuelle Eigenschaften?
+     * - Referenzen auf Objekt und Verursacher
+     * - Referenzen f�r globale Liste
+     * > die Wirkung:
+     * - Dauer
+     * - Widerstandskraft, zb gegen Antimagie
+     * - Seiteneffekte zb Flag ONLYONE, Unvertr�glichkeiten
+     * - Alterungsverhalten zb Flag NOAGE
+     * - Effektverhalten, zb Bonus (variabel)
+     * - bei Einheitenzaubern die Zahl der betroffenen Personen
+     *
+     * Dabei sind nur die beiden letzten Punkte wirklich reine individuelle
+     * Wirkung, die anderen sind eher allgemeine Kennzeichen eines jeden
+     * Curse, die individuell belegt sind.
+     * ONLYONE und NOAGE k�nnten auch Eigenschaften des Typs sein, nicht des
+     * individuellen curse. Allgemein ist Alterung wohl eher eine
+     * Typeigenschaft als die eines individuellen curse.
+     * Dagegen ist der Widerstand gegen Antimagie sowohl abh�ngig von der
+     * G�te des Verursachers, also des Magiers zum Zeitpunkt des Zaubers,
+     * als auch vom Typ, der gegen bestimmte Arten des 'Fluchbrechens' immun
+     * sein k�nnte.
+     *
+     * Was sind wichtige Typeigenschaften?
+     * - Verhalten bei Personen�bergaben
+     * - allgemeine Wirkung
+     * - Beschreibungstexte
+     * - Verhalten bei Antimagie
+     * - Alterung
+     * - Speicherung des C-Objekts
+     * - Laden des C-Objekts
+     * - Erzeugen des C-Objekts
+     * - L�schen und Aufr�umen des C-Objekts
+     * - Funktionen zur �nderung der Werte
+     *
+     * */
 
 #include <util/variant.h>
 
-/* ------------------------------------------------------------- */
-/* Zauberwirkungen */
-/* nicht vergessen curse_type zu aktualisieren und Reihenfolge beachten!
- */
+    /* ------------------------------------------------------------- */
+    /* Zauberwirkungen */
+    /* nicht vergessen curse_type zu aktualisieren und Reihenfolge beachten!
+     */
 
-  enum {
-/* struct's vom typ curse: */
-    C_FOGTRAP,
-    C_ANTIMAGICZONE,
-    C_FARVISION,
-    C_GBDREAM,
-    C_AURA,
-    C_MAELSTROM,
-    C_BLESSEDHARVEST,
-    C_DROUGHT,
-    C_BADLEARN,
-    C_SHIP_SPEEDUP,             /*  9 - Sturmwind-Zauber */
-    C_SHIP_FLYING,              /* 10 - Luftschiff-Zauber */
-    C_SHIP_NODRIFT,             /* 11 - G�nstigeWinde-Zauber */
-    C_DEPRESSION,
-    C_MAGICWALLS,               /* 13 - Heimstein */
-    C_STRONGWALL,               /* 14 - Feste Mauer - Precombat */
-    C_ASTRALBLOCK,              /* 15 - Astralblock */
-    C_GENEROUS,                 /* 16 - Unterhaltung vermehren */
-    C_PEACE,                    /* 17 - Regionsweit Attacken verhindern */
-    C_MAGICSTREET,              /* 19 - magisches Stra�ennetz */
-    C_RESIST_MAGIC,             /* 20 - ver�ndert Magieresistenz von Objekten */
-    C_SONG_BADMR,               /* 21 - ver�ndert Magieresistenz */
-    C_SONG_GOODMR,              /* 22 - ver�ndert Magieresistenz */
-    C_SLAVE,                    /* 23 - dient fremder Partei */
-    C_CALM,                     /* 25 - Beinflussung */
-    C_OLDRACE,
-    C_FUMBLE,
-    C_RIOT,                     /*region in Aufruhr */
-    C_NOCOST,
-    C_CURSED_BY_THE_GODS,
-/* struct's vom untertyp curse_unit: */
-    C_SPEED,                    /* Beschleunigt */
-    C_ORC,
-    C_MBOOST,
-    C_KAELTESCHUTZ,
-    C_STRENGTH,
-    C_ALLSKILLS,
-    C_MAGICRESISTANCE,          /* 44 - ver�ndert Magieresistenz */
-    C_ITEMCLOAK,
-    C_SPARKLE,
-/* struct's vom untertyp curse_skill: */
-    C_SKILL,
-    MAXCURSE                    /* OBS: when removing curses, remember to update read_ccompat() */
-  };
+    enum {
+        /* struct's vom typ curse: */
+        C_FOGTRAP,
+        C_ANTIMAGICZONE,
+        C_FARVISION,
+        C_GBDREAM,
+        C_AURA,
+        C_MAELSTROM,
+        C_BLESSEDHARVEST,
+        C_DROUGHT,
+        C_BADLEARN,
+        C_SHIP_SPEEDUP,             /*  9 - Sturmwind-Zauber */
+        C_SHIP_FLYING,              /* 10 - Luftschiff-Zauber */
+        C_SHIP_NODRIFT,             /* 11 - G�nstigeWinde-Zauber */
+        C_DEPRESSION,
+        C_MAGICWALLS,               /* 13 - Heimstein */
+        C_STRONGWALL,               /* 14 - Feste Mauer - Precombat */
+        C_ASTRALBLOCK,              /* 15 - Astralblock */
+        C_GENEROUS,                 /* 16 - Unterhaltung vermehren */
+        C_PEACE,                    /* 17 - Regionsweit Attacken verhindern */
+        C_MAGICSTREET,              /* 19 - magisches Stra�ennetz */
+        C_RESIST_MAGIC,             /* 20 - ver�ndert Magieresistenz von Objekten */
+        C_SONG_BADMR,               /* 21 - ver�ndert Magieresistenz */
+        C_SONG_GOODMR,              /* 22 - ver�ndert Magieresistenz */
+        C_SLAVE,                    /* 23 - dient fremder Partei */
+        C_CALM,                     /* 25 - Beinflussung */
+        C_OLDRACE,
+        C_FUMBLE,
+        C_RIOT,                     /*region in Aufruhr */
+        C_NOCOST,
+        C_CURSED_BY_THE_GODS,
+        /* struct's vom untertyp curse_unit: */
+        C_SPEED,                    /* Beschleunigt */
+        C_ORC,
+        C_MBOOST,
+        C_KAELTESCHUTZ,
+        C_STRENGTH,
+        C_ALLSKILLS,
+        C_MAGICRESISTANCE,          /* 44 - ver�ndert Magieresistenz */
+        C_ITEMCLOAK,
+        C_SPARKLE,
+        /* struct's vom untertyp curse_skill: */
+        C_SKILL,
+        MAXCURSE                    /* OBS: when removing curses, remember to update read_ccompat() */
+    };
 
-/* ------------------------------------------------------------- */
-/* Flags */
+    /* ------------------------------------------------------------- */
+    /* Flags */
 
-/* Verhalten von Zaubern auf Units beim �bergeben von Personen */
-  typedef enum {
-    CURSE_ISNEW = 0x01,         /* wirkt in der zauberrunde nicht (default) */
-    CURSE_NOAGE = 0x02,         /* wirkt ewig */
-    CURSE_IMMUNE = 0x04,        /* ignoriert Antimagie */
-    CURSE_ONLYONE = 0x08,       /* Verhindert, das ein weiterer Zauber dieser Art auf das Objekt gezaubert wird */
+    /* Verhalten von Zaubern auf Units beim �bergeben von Personen */
+    typedef enum {
+        CURSE_ISNEW = 0x01,         /* wirkt in der zauberrunde nicht (default) */
+        CURSE_NOAGE = 0x02,         /* wirkt ewig */
+        CURSE_IMMUNE = 0x04,        /* ignoriert Antimagie */
+        CURSE_ONLYONE = 0x08,       /* Verhindert, das ein weiterer Zauber dieser Art auf das Objekt gezaubert wird */
 
-    /* the following are mutually exclusive */
-    CURSE_SPREADNEVER = 0x00,   /* wird nie mit �bertragen */
-    CURSE_SPREADALWAYS = 0x10,  /* wird immer mit �bertragen */
-    CURSE_SPREADMODULO = 0x20,  /* personenweise weitergabe */
-    CURSE_SPREADCHANCE = 0x30   /* Ansteckungschance je nach Mengenverh�ltnis */
-  } curseflags;
+        /* the following are mutually exclusive */
+        CURSE_SPREADNEVER = 0x00,   /* wird nie mit �bertragen */
+        CURSE_SPREADALWAYS = 0x10,  /* wird immer mit �bertragen */
+        CURSE_SPREADMODULO = 0x20,  /* personenweise weitergabe */
+        CURSE_SPREADCHANCE = 0x30   /* Ansteckungschance je nach Mengenverh�ltnis */
+    } curseflags;
 
 #define CURSE_FLAGSMASK 0x0F
 #define CURSE_SPREADMASK 0x30
 
-/* typ von struct */
-  enum {
-    CURSETYP_NORM,
-    CURSETYP_UNIT,
-    CURSETYP_REGION,            /* stores the region in c->data.v */
-    MAXCURSETYP
-  };
+    /* typ von struct */
+    enum {
+        CURSETYP_NORM,
+        CURSETYP_UNIT,
+        CURSETYP_REGION,            /* stores the region in c->data.v */
+        MAXCURSETYP
+    };
 
-/* Verhalten beim Zusammenfassen mit einem schon bestehenden Zauber
- * gleichen Typs */
+    /* Verhalten beim Zusammenfassen mit einem schon bestehenden Zauber
+     * gleichen Typs */
 
 #define NO_MERGE      0         /* erzeugt jedesmal einen neuen Zauber */
 #define M_DURATION    1         /* Die Zauberdauer ist die maximale Dauer beider */
@@ -180,143 +180,143 @@ extern "C" {
 #define M_MAXEFFECT   4         /* der Effekt ist der maximale Effekt beider */
 #define M_SUMEFFECT   8         /* der Effekt summiert sich */
 #define M_MEN        16         /* die Anzahl der betroffenen Personen summiert
-                                   sich */
+     sich */
 #define M_VIGOUR     32         /* das Maximum der beiden St�rken wird die
-                                   St�rke des neuen Zaubers */
+     St�rke des neuen Zaubers */
 #define M_VIGOUR_ADD 64         /* Vigour wird addiert */
 
-/* ------------------------------------------------------------- */
-/* Allgemeine Zauberwirkungen */
+    /* ------------------------------------------------------------- */
+    /* Allgemeine Zauberwirkungen */
 
-  typedef struct curse {
-    struct curse *nexthash;
-    int no;                     /* 'Einheitennummer' dieses Curse */
-    const struct curse_type *type;      /* Zeiger auf ein curse_type-struct */
-    int flags;         /* WARNING: these are XORed with type->flags! */
-    int duration;               /* Dauer der Verzauberung. Wird jede Runde vermindert */
-    float vigour;              /* St�rke der Verzauberung, Widerstand gegen Antimagie */
-    struct unit *magician;      /* Pointer auf den Magier, der den Spruch gewirkt hat */
-    float effect;
-    variant data;               /* pointer auf spezielle curse-unterstructs */
-  } curse;
+    typedef struct curse {
+        struct curse *nexthash;
+        int no;                     /* 'Einheitennummer' dieses Curse */
+        const struct curse_type *type;      /* Zeiger auf ein curse_type-struct */
+        int flags;         /* WARNING: these are XORed with type->flags! */
+        int duration;               /* Dauer der Verzauberung. Wird jede Runde vermindert */
+        float vigour;              /* St�rke der Verzauberung, Widerstand gegen Antimagie */
+        struct unit *magician;      /* Pointer auf den Magier, der den Spruch gewirkt hat */
+        float effect;
+        variant data;               /* pointer auf spezielle curse-unterstructs */
+    } curse;
 
 #define c_flags(c) ((c)->type->flags ^ (c)->flags)
 
-/* ------------------------------------------------------------- */
+    /* ------------------------------------------------------------- */
 
-  typedef struct curse_type {
-    const char *cname;          /* Name der Zauberwirkung, Identifizierung des curse */
-    int typ;
-    int flags;
-    int mergeflags;
-    struct message *(*curseinfo) (const void *, objtype_t, const struct curse *,
-      int);
-    void(*change_vigour) (curse *, float);
-    int (*read) (struct storage * store, curse * c, void *target);
-    int (*write) (struct storage * store, const struct curse * c,
-      const void *target);
-    int (*cansee) (const struct faction *, const void *, objtype_t,
-      const struct curse *, int);
-    int (*age) (curse *);
-  } curse_type;
+    typedef struct curse_type {
+        const char *cname;          /* Name der Zauberwirkung, Identifizierung des curse */
+        int typ;
+        int flags;
+        int mergeflags;
+        struct message *(*curseinfo) (const void *, objtype_t, const struct curse *,
+            int);
+        void(*change_vigour) (curse *, float);
+        int(*read) (struct storage * store, curse * c, void *target);
+        int(*write) (struct storage * store, const struct curse * c,
+            const void *target);
+        int(*cansee) (const struct faction *, const void *, objtype_t,
+            const struct curse *, int);
+        int(*age) (curse *);
+    } curse_type;
 
-  extern struct attrib_type at_curse;
-  void curse_write(const struct attrib *a, const void *owner,
+    extern struct attrib_type at_curse;
+    void curse_write(const struct attrib *a, const void *owner,
     struct storage *store);
-  int curse_read(struct attrib *a, void *owner, struct storage *store);
+    int curse_read(struct attrib *a, void *owner, struct storage *store);
 
-/* ------------------------------------------------------------- */
-/* Kommentare:
- * Bei einigen Typen von Verzauberungen (z.B.Skillmodif.) muss neben
- * der curse-id noch ein weiterer Identifizierer angegeben werden (id2).
- *
- * Wenn der Typ korrekt definiert wurde, erfolgt die Verzweigung zum
- * korrekten Typus automatisch, und die unterschiedlichen struct-typen
- * sind nach aussen unsichtbar.
- *
-* allgemeine Funktionen *
-*/
+    /* ------------------------------------------------------------- */
+    /* Kommentare:
+     * Bei einigen Typen von Verzauberungen (z.B.Skillmodif.) muss neben
+     * der curse-id noch ein weiterer Identifizierer angegeben werden (id2).
+     *
+     * Wenn der Typ korrekt definiert wurde, erfolgt die Verzweigung zum
+     * korrekten Typus automatisch, und die unterschiedlichen struct-typen
+     * sind nach aussen unsichtbar.
+     *
+     * allgemeine Funktionen *
+     */
 
-  curse *create_curse(struct unit *magician, struct attrib **ap,
-    const curse_type * ctype, float vigour, int duration, float ceffect,
-    int men);
-  /* Verzweigt automatisch zum passenden struct-typ. Sollte es schon
-   * einen Zauber dieses Typs geben, so wird der neue dazuaddiert. Die
-   * Zahl der verzauberten Personen sollte beim Aufruf der Funktion
-   * nochmal gesondert auf min(get_cursedmen, u->number) gesetzt werden.
-   */
+    curse *create_curse(struct unit *magician, struct attrib **ap,
+        const curse_type * ctype, float vigour, int duration, float ceffect,
+        int men);
+    /* Verzweigt automatisch zum passenden struct-typ. Sollte es schon
+     * einen Zauber dieses Typs geben, so wird der neue dazuaddiert. Die
+     * Zahl der verzauberten Personen sollte beim Aufruf der Funktion
+     * nochmal gesondert auf min(get_cursedmen, u->number) gesetzt werden.
+     */
 
-  extern void destroy_curse(curse * c);
+    void destroy_curse(curse * c);
 
-  bool is_cursed_internal(struct attrib *ap, const curse_type * ctype);
-  /* ignoriert CURSE_ISNEW */
+    bool is_cursed_internal(struct attrib *ap, const curse_type * ctype);
+    /* ignoriert CURSE_ISNEW */
 
-  bool remove_curse(struct attrib **ap, const struct curse *c);
-  /* l�scht einen konkreten Spruch auf einem Objekt.
-   */
+    bool remove_curse(struct attrib **ap, const struct curse *c);
+    /* l�scht einen konkreten Spruch auf einem Objekt.
+     */
 
-  int curse_geteffect_int(const struct curse *c);
-  float curse_geteffect(const struct curse *c);
-  /* gibt die Auswirkungen der Verzauberungen zur�ck. zB bei
-   * Skillmodifiziernden Verzauberungen ist hier der Modifizierer
-   * gespeichert. Wird automatisch beim Anlegen eines neuen curse
-   * gesetzt. Gibt immer den ersten Treffer von ap aus zur�ck.
-   */
+    int curse_geteffect_int(const struct curse *c);
+    float curse_geteffect(const struct curse *c);
+    /* gibt die Auswirkungen der Verzauberungen zur�ck. zB bei
+     * Skillmodifiziernden Verzauberungen ist hier der Modifizierer
+     * gespeichert. Wird automatisch beim Anlegen eines neuen curse
+     * gesetzt. Gibt immer den ersten Treffer von ap aus zur�ck.
+     */
 
-  float curse_changevigour(struct attrib **ap, curse * c, float i);
-  /* ver�ndert die St�rke der Verzauberung um i */
+    float curse_changevigour(struct attrib **ap, curse * c, float i);
+    /* ver�ndert die St�rke der Verzauberung um i */
 
-  extern int get_cursedmen(struct unit *u, const struct curse *c);
-  /* gibt bei Personenbeschr�nkten Verzauberungen die Anzahl der
-   * betroffenen Personen zur�ck. Ansonsten wird 0 zur�ckgegeben. */
+    int get_cursedmen(struct unit *u, const struct curse *c);
+    /* gibt bei Personenbeschr�nkten Verzauberungen die Anzahl der
+     * betroffenen Personen zur�ck. Ansonsten wird 0 zur�ckgegeben. */
 
-  extern void c_setflag(curse * c, unsigned int flag);
-  extern void c_clearflag(curse * c, unsigned int flags);
-  /* setzt/loescht Spezialflag einer Verzauberung (zB 'dauert ewig') */
+    void c_setflag(curse * c, unsigned int flag);
+    void c_clearflag(curse * c, unsigned int flags);
+    /* setzt/loescht Spezialflag einer Verzauberung (zB 'dauert ewig') */
 
-  void transfer_curse(struct unit *u, struct unit *u2, int n);
-  /* sorgt daf�r, das bei der �bergabe von Personen die curse-attribute
-   * korrekt gehandhabt werden. Je nach internen Flag kann dies
-   * unterschiedlich gew�nscht sein
-   * */
+    void transfer_curse(struct unit *u, struct unit *u2, int n);
+    /* sorgt daf�r, das bei der �bergabe von Personen die curse-attribute
+     * korrekt gehandhabt werden. Je nach internen Flag kann dies
+     * unterschiedlich gew�nscht sein
+     * */
 
-  extern struct curse *get_curse(struct attrib *ap, const curse_type * ctype);
-  /* gibt pointer auf die erste curse-struct zur�ck, deren Typ ctype ist,
-   * oder einen NULL-pointer
-   * */
+    struct curse *get_curse(struct attrib *ap, const curse_type * ctype);
+    /* gibt pointer auf die erste curse-struct zur�ck, deren Typ ctype ist,
+     * oder einen NULL-pointer
+     * */
 
-  int find_cursebyname(const char *c);
-  const curse_type *ct_find(const char *c);
-  void ct_register(const curse_type *);
-/* Regionszauber */
+    int find_cursebyname(const char *c);
+    const curse_type *ct_find(const char *c);
+    void ct_register(const curse_type *);
+    /* Regionszauber */
 
-  curse *cfindhash(int i);
+    curse *cfindhash(int i);
 
-  curse *findcurse(int curseid);
+    curse *findcurse(int curseid);
 
-  extern void curse_init(struct attrib *a);
-  extern void curse_done(struct attrib *a);
-  extern int curse_age(struct attrib *a);
+    void curse_init(struct attrib *a);
+    void curse_done(struct attrib *a);
+    int curse_age(struct attrib *a);
 
-  extern float destr_curse(struct curse *c, int cast_level, float force);
+    float destr_curse(struct curse *c, int cast_level, float force);
 
-  extern int resolve_curse(variant data, void *address);
-  extern bool is_cursed_with(const struct attrib *ap, const struct curse *c);
+    int resolve_curse(variant data, void *address);
+    bool is_cursed_with(const struct attrib *ap, const struct curse *c);
 
-  extern bool curse_active(const struct curse *c);
-  /* gibt true, wenn der Curse nicht NULL oder inaktiv ist */
+    bool curse_active(const struct curse *c);
+    /* gibt true, wenn der Curse nicht NULL oder inaktiv ist */
 
-/*** COMPATIBILITY MACROS. DO NOT USE FOR NEW CODE, REPLACE IN OLD CODE: */
-  extern const char *oldcursename(int id);
-  extern struct message *cinfo_simple(const void *obj, objtype_t typ,
-    const struct curse *c, int self);
+    /*** COMPATIBILITY MACROS. DO NOT USE FOR NEW CODE, REPLACE IN OLD CODE: */
+    const char *oldcursename(int id);
+    struct message *cinfo_simple(const void *obj, objtype_t typ,
+        const struct curse *c, int self);
 
 #define is_cursed(a, id, id2) \
   curse_active(get_curse(a, ct_find(oldcursename(id))))
 #define get_curseeffect(a, id, id2) \
   curse_geteffect(get_curse(a, ct_find(oldcursename(id))))
 
-/* eressea-defined attribute-type flags */
+    /* eressea-defined attribute-type flags */
 #define ATF_CURSE  ATF_USER_DEFINED
 
 #ifdef __cplusplus
diff --git a/src/kernel/curse.test.c b/src/kernel/curse.test.c
index ecee69c24..577d6551a 100644
--- a/src/kernel/curse.test.c
+++ b/src/kernel/curse.test.c
@@ -12,18 +12,18 @@
 
 static void test_curse(CuTest * tc)
 {
-  attrib *attrs = NULL;
-  curse *c, *result;
-  int cid;
+    attrib *attrs = NULL;
+    curse *c, *result;
+    int cid;
 
-  curse_type ct_dummy = { "dummy", CURSETYP_NORM, 0, M_SUMEFFECT, NULL };
-  c = create_curse(NULL, &attrs, &ct_dummy, 1.0, 1, 1, 1);
-  cid = c->no;
-  result = findcurse(cid);
-  CuAssertPtrEquals(tc, c, result);
-  destroy_curse(c);
-  result = findcurse(cid);
-  CuAssertPtrEquals(tc, NULL, result);
+    curse_type ct_dummy = { "dummy", CURSETYP_NORM, 0, M_SUMEFFECT, NULL };
+    c = create_curse(NULL, &attrs, &ct_dummy, 1.0, 1, 1, 1);
+    cid = c->no;
+    result = findcurse(cid);
+    CuAssertPtrEquals(tc, c, result);
+    destroy_curse(c);
+    result = findcurse(cid);
+    CuAssertPtrEquals(tc, NULL, result);
 }
 
 typedef struct {
@@ -85,11 +85,11 @@ static void test_bad_dreams(CuTest *tc) {
 
 CuSuite *get_curse_suite(void)
 {
-  CuSuite *suite = CuSuiteNew();
-  SUITE_ADD_TEST(suite, test_curse);
-  SUITE_ADD_TEST(suite, test_magicstreet);
-  SUITE_ADD_TEST(suite, test_magicstreet_warning);
-  SUITE_ADD_TEST(suite, test_good_dreams);
-  SUITE_ADD_TEST(suite, test_bad_dreams);
-  return suite;
+    CuSuite *suite = CuSuiteNew();
+    SUITE_ADD_TEST(suite, test_curse);
+    SUITE_ADD_TEST(suite, test_magicstreet);
+    SUITE_ADD_TEST(suite, test_magicstreet_warning);
+    SUITE_ADD_TEST(suite, test_good_dreams);
+    SUITE_ADD_TEST(suite, test_bad_dreams);
+    return suite;
 }
diff --git a/src/kernel/equipment.c b/src/kernel/equipment.c
index e20bc6d34..116b26b26 100644
--- a/src/kernel/equipment.c
+++ b/src/kernel/equipment.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -41,95 +41,97 @@ static equipment *equipment_sets;
 
 equipment *create_equipment(const char *eqname)
 {
-  equipment **eqp = &equipment_sets;
-  for (;;) {
-    struct equipment *eq = *eqp;
-    int i = eq ? strcmp(eq->name, eqname) : 1;
-    if (i > 0) {
-      eq = (equipment *)calloc(1, sizeof(equipment));
-      eq->name = _strdup(eqname);
-      eq->next = *eqp;
-      memset(eq->skills, 0, sizeof(eq->skills));
-      *eqp = eq;
-      break;
-    } else if (i == 0) {
-      break;
+    equipment **eqp = &equipment_sets;
+    for (;;) {
+        struct equipment *eq = *eqp;
+        int i = eq ? strcmp(eq->name, eqname) : 1;
+        if (i > 0) {
+            eq = (equipment *)calloc(1, sizeof(equipment));
+            eq->name = _strdup(eqname);
+            eq->next = *eqp;
+            memset(eq->skills, 0, sizeof(eq->skills));
+            *eqp = eq;
+            break;
+        }
+        else if (i == 0) {
+            break;
+        }
+        eqp = &eq->next;
     }
-    eqp = &eq->next;
-  }
-  return *eqp;
+    return *eqp;
 }
 
 equipment *get_equipment(const char *eqname)
 {
-  equipment *eq = equipment_sets;
-  for (; eq; eq = eq->next) {
-    int i = strcmp(eq->name, eqname);
-    if (i == 0)
-      return eq;
-    else if (i > 0)
-      break;
-  }
-  return NULL;
+    equipment *eq = equipment_sets;
+    for (; eq; eq = eq->next) {
+        int i = strcmp(eq->name, eqname);
+        if (i == 0)
+            return eq;
+        else if (i > 0)
+            break;
+    }
+    return NULL;
 }
 
 void equipment_setskill(equipment * eq, skill_t sk, const char *value)
 {
-  if (eq != NULL) {
-    if (value != NULL) {
-      eq->skills[sk] = _strdup(value);
-    } else if (eq->skills[sk]) {
-      free(eq->skills[sk]);
+    if (eq != NULL) {
+        if (value != NULL) {
+            eq->skills[sk] = _strdup(value);
+        }
+        else if (eq->skills[sk]) {
+            free(eq->skills[sk]);
+        }
     }
-  }
 }
 
 void equipment_addspell(equipment * eq, struct spell * sp, int level)
 {
-  if (eq) {
-    if (!eq->spellbook) {
-      eq->spellbook = create_spellbook(0);
+    if (eq) {
+        if (!eq->spellbook) {
+            eq->spellbook = create_spellbook(0);
+        }
+        spellbook_add(eq->spellbook, sp, level);
     }
-    spellbook_add(eq->spellbook, sp, level);
-  }
 }
 
 void
 equipment_setitem(equipment * eq, const item_type * itype, const char *value)
 {
-  if (eq != NULL) {
-    if (itype != NULL) {
-      itemdata *idata = eq->items;
-      while (idata && idata->itype != itype) {
-        idata = idata->next;
-      }
-      if (idata == NULL) {
-        idata = (itemdata *) malloc(sizeof(itemdata));
-        idata->itype = itype;
-        idata->value = _strdup(value);
-        idata->next = eq->items;
-        eq->items = idata;
-      }
+    if (eq != NULL) {
+        if (itype != NULL) {
+            itemdata *idata = eq->items;
+            while (idata && idata->itype != itype) {
+                idata = idata->next;
+            }
+            if (idata == NULL) {
+                idata = (itemdata *)malloc(sizeof(itemdata));
+                idata->itype = itype;
+                idata->value = _strdup(value);
+                idata->next = eq->items;
+                eq->items = idata;
+            }
+        }
     }
-  }
 }
 
 void
 equipment_setcallback(struct equipment *eq,
-  void (*callback) (const struct equipment *, struct unit *))
+void(*callback) (const struct equipment *, struct unit *))
 {
-  eq->callback = callback;
+    eq->callback = callback;
 }
 
 void equip_unit(struct unit *u, const struct equipment *eq)
 {
-  equip_unit_mask(u, eq, EQUIP_ALL);
+    equip_unit_mask(u, eq, EQUIP_ALL);
 }
 
 void equip_unit_mask(struct unit *u, const struct equipment *eq, int mask)
 {
     if (eq) {
-        
+
         if (mask & EQUIP_SKILLS) {
             int sk;
             for (sk = 0; sk != MAXSKILLS; ++sk) {
@@ -137,27 +139,27 @@ void equip_unit_mask(struct unit *u, const struct equipment *eq, int mask)
                     int i = dice_rand(eq->skills[sk]);
                     if (i > 0) {
                         set_level(u, (skill_t)sk, i);
-                        if (sk==SK_STAMINA) {
+                        if (sk == SK_STAMINA) {
                             u->hp = unit_max_hp(u) * u->number;
                         }
                     }
                 }
             }
         }
-        
+
         if (mask & EQUIP_SPELLS) {
             if (eq->spellbook) {
                 quicklist * ql = eq->spellbook->spells;
                 int qi;
                 sc_mage * mage = get_mage(u);
-                
+
                 for (qi = 0; ql; ql_advance(&ql, &qi, 1)) {
-                    spellbook_entry *sbe = (spellbook_entry *) ql_get(ql, qi);
+                    spellbook_entry *sbe = (spellbook_entry *)ql_get(ql, qi);
                     unit_add_spell(u, mage, sbe->sp, sbe->level);
                 }
             }
         }
-        
+
         if (mask & EQUIP_ITEMS) {
             itemdata *idata;
             for (idata = eq->items; idata != NULL; idata = idata->next) {
@@ -167,7 +169,7 @@ void equip_unit_mask(struct unit *u, const struct equipment *eq, int mask)
                 }
             }
         }
-        
+
         if (eq->subsets) {
             int i;
             for (i = 0; eq->subsets[i].sets; ++i) {
@@ -184,40 +186,40 @@ void equip_unit_mask(struct unit *u, const struct equipment *eq, int mask)
                 }
             }
         }
-        
+
         if (mask & EQUIP_SPECIAL) {
             if (eq->callback)
-              eq->callback(eq, u);
+                eq->callback(eq, u);
         }
     }
 }
 
 void equip_items(struct item **items, const struct equipment *eq)
 {
-  if (eq) {
-    itemdata *idata;
+    if (eq) {
+        itemdata *idata;
 
-    for (idata = eq->items; idata != NULL; idata = idata->next) {
-      int i = dice_rand(idata->value);
-      if (i > 0) {
-        i_add(items, i_new(idata->itype, i));
-      }
-    }
-    if (eq->subsets) {
-      int i;
-      for (i = 0; eq->subsets[i].sets; ++i) {
-        if (chance(eq->subsets[i].chance)) {
-          float rnd = (1 + rng_int() % 1000) / 1000.0f;
-          int k;
-          for (k = 0; eq->subsets[i].sets[k].set; ++k) {
-            if (rnd <= eq->subsets[i].sets[k].chance) {
-              equip_items(items, eq->subsets[i].sets[k].set);
-              break;
+        for (idata = eq->items; idata != NULL; idata = idata->next) {
+            int i = dice_rand(idata->value);
+            if (i > 0) {
+                i_add(items, i_new(idata->itype, i));
+            }
+        }
+        if (eq->subsets) {
+            int i;
+            for (i = 0; eq->subsets[i].sets; ++i) {
+                if (chance(eq->subsets[i].chance)) {
+                    float rnd = (1 + rng_int() % 1000) / 1000.0f;
+                    int k;
+                    for (k = 0; eq->subsets[i].sets[k].set; ++k) {
+                        if (rnd <= eq->subsets[i].sets[k].chance) {
+                            equip_items(items, eq->subsets[i].sets[k].set);
+                            break;
+                        }
+                        rnd -= eq->subsets[i].sets[k].chance;
+                    }
+                }
             }
-            rnd -= eq->subsets[i].sets[k].chance;
-          }
         }
-      }
     }
-  }
 }
diff --git a/src/kernel/equipment.h b/src/kernel/equipment.h
index 619b05193..432af5b00 100644
--- a/src/kernel/equipment.h
+++ b/src/kernel/equipment.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -38,12 +38,12 @@ extern "C" {
         struct equipment *set;
         float chance;
     } subsetitem;
-    
+
     typedef struct subset {
         float chance;
         subsetitem *sets;
     } subset;
-    
+
     typedef struct equipment {
         char *name;
         struct itemdata *items;
@@ -51,29 +51,29 @@ extern "C" {
         struct spellbook *spellbook;
         struct subset *subsets;
         struct equipment *next;
-        void (*callback) (const struct equipment *, struct unit *);
+        void(*callback) (const struct equipment *, struct unit *);
     } equipment;
-    
-  extern struct equipment *create_equipment(const char *eqname);
-  extern struct equipment *get_equipment(const char *eqname);
 
-  extern void equipment_setitem(struct equipment *eq,
-    const struct item_type *itype, const char *value);
-  extern void equipment_setskill(struct equipment *eq, skill_t sk,
-    const char *value);
-  extern void equipment_addspell(struct equipment *eq, struct spell *sp, int level);
-  extern void equipment_setcallback(struct equipment *eq,
-    void (*callback) (const struct equipment *, struct unit *));
+    struct equipment *create_equipment(const char *eqname);
+    struct equipment *get_equipment(const char *eqname);
 
-  extern void equip_unit(struct unit *u, const struct equipment *eq);
+    void equipment_setitem(struct equipment *eq,
+        const struct item_type *itype, const char *value);
+    void equipment_setskill(struct equipment *eq, skill_t sk,
+        const char *value);
+    void equipment_addspell(struct equipment *eq, struct spell *sp, int level);
+    void equipment_setcallback(struct equipment *eq,
+        void(*callback) (const struct equipment *, struct unit *));
+
+    void equip_unit(struct unit *u, const struct equipment *eq);
 #define EQUIP_SKILLS  (1<<1)
 #define EQUIP_SPELLS  (1<<2)
 #define EQUIP_ITEMS   (1<<3)
 #define EQUIP_SPECIAL (1<<4)
 #define EQUIP_ALL     (0xFF)
-  extern void equip_unit_mask(struct unit *u, const struct equipment *eq,
-    int mask);
-  extern void equip_items(struct item **items, const struct equipment *eq);
+    void equip_unit_mask(struct unit *u, const struct equipment *eq,
+        int mask);
+    void equip_items(struct item **items, const struct equipment *eq);
 
 #ifdef __cplusplus
 }
diff --git a/src/kernel/equipment.test.c b/src/kernel/equipment.test.c
index 54bdc113f..851e591d2 100644
--- a/src/kernel/equipment.test.c
+++ b/src/kernel/equipment.test.c
@@ -14,42 +14,42 @@
 
 void test_equipment(CuTest * tc)
 {
-  equipment * eq;
-  unit * u;
-  const item_type * it_horses;
-  spell *sp;
-  sc_mage * mage;
-  
-  test_cleanup();
-  test_create_race("human");
-  enable_skill(SK_MAGIC, true);
-  it_horses = test_create_itemtype("horse");
-  CuAssertPtrNotNull(tc, it_horses);
-  sp = create_spell("testspell", 0);
-  CuAssertPtrNotNull(tc, sp);
+    equipment * eq;
+    unit * u;
+    const item_type * it_horses;
+    spell *sp;
+    sc_mage * mage;
 
-  CuAssertPtrEquals(tc, 0, get_equipment("herpderp"));
-  eq = create_equipment("herpderp");
-  CuAssertPtrEquals(tc, eq, get_equipment("herpderp"));
+    test_cleanup();
+    test_create_race("human");
+    enable_skill(SK_MAGIC, true);
+    it_horses = test_create_itemtype("horse");
+    CuAssertPtrNotNull(tc, it_horses);
+    sp = create_spell("testspell", 0);
+    CuAssertPtrNotNull(tc, sp);
 
-  equipment_setitem(eq, it_horses, "1");
-  equipment_setskill(eq, SK_MAGIC, "5");
-  equipment_addspell(eq, sp, 1);
+    CuAssertPtrEquals(tc, 0, get_equipment("herpderp"));
+    eq = create_equipment("herpderp");
+    CuAssertPtrEquals(tc, eq, get_equipment("herpderp"));
 
-  u = test_create_unit(0, 0);
-  equip_unit_mask(u, eq, EQUIP_ALL);
-  CuAssertIntEquals(tc, 1, i_get(u->items, it_horses));
-  CuAssertIntEquals(tc, 5, get_level(u, SK_MAGIC));
+    equipment_setitem(eq, it_horses, "1");
+    equipment_setskill(eq, SK_MAGIC, "5");
+    equipment_addspell(eq, sp, 1);
 
-  mage = get_mage(u);
-  CuAssertPtrNotNull(tc, mage);
-  CuAssertPtrNotNull(tc, mage->spellbook);
-  CuAssertTrue(tc, u_hasspell(u, sp));
+    u = test_create_unit(0, 0);
+    equip_unit_mask(u, eq, EQUIP_ALL);
+    CuAssertIntEquals(tc, 1, i_get(u->items, it_horses));
+    CuAssertIntEquals(tc, 5, get_level(u, SK_MAGIC));
+
+    mage = get_mage(u);
+    CuAssertPtrNotNull(tc, mage);
+    CuAssertPtrNotNull(tc, mage->spellbook);
+    CuAssertTrue(tc, u_hasspell(u, sp));
 }
 
 CuSuite *get_equipment_suite(void)
 {
-  CuSuite *suite = CuSuiteNew();
-  SUITE_ADD_TEST(suite, test_equipment);
-  return suite;
+    CuSuite *suite = CuSuiteNew();
+    SUITE_ADD_TEST(suite, test_equipment);
+    return suite;
 }
diff --git a/src/kernel/faction.c b/src/kernel/faction.c
index b17db7b3d..496e14356 100755
--- a/src/kernel/faction.c
+++ b/src/kernel/faction.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/kernel/faction.h b/src/kernel/faction.h
index 31705860f..0b3bda991 100644
--- a/src/kernel/faction.h
+++ b/src/kernel/faction.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -26,15 +26,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  struct alliance;
-  struct item;
-  struct seen_region;
+    struct alliance;
+    struct item;
+    struct seen_region;
 
-/* SMART_INTERVALS: define to speed up finding the interval of regions that a 
-   faction is in. defining this speeds up the turn by 30-40% */
+    /* SMART_INTERVALS: define to speed up finding the interval of regions that a
+       faction is in. defining this speeds up the turn by 30-40% */
 #define SMART_INTERVALS
 
-/* faction flags */
+    /* faction flags */
 #define FFL_NEWID (1<<0)        /* Die Partei hat bereits einmal ihre no gewechselt */
 #define FFL_ISNEW         (1<<1)
 #define FFL_RESTART       (1<<2)
@@ -43,122 +43,122 @@ extern "C" {
 #define FFL_SELECT        (1<<18)       /* ehemals f->dh, u->dh, r->dh, etc... */
 #define FFL_NOAID         (1<<21)       /* Hilfsflag Kampf */
 #define FFL_MARK          (1<<23)       /* f�r markierende algorithmen, die das 
-                                         * hinterher auch wieder l�schen m�ssen! 
-                                         * (FFL_SELECT muss man vorher initialisieren, 
-                                         * FL_MARK hinterher l�schen) */
+                                             * hinterher auch wieder l�schen m�ssen!
+                                             * (FFL_SELECT muss man vorher initialisieren,
+                                             * FL_MARK hinterher l�schen) */
 #define FFL_NOIDLEOUT     (1<<24)       /* Partei stirbt nicht an NMRs */
 #define FFL_NPC           (1<<25)       /* eine Partei mit Monstern */
 #define FFL_DBENTRY       (1<<28)       /* Partei ist in Datenbank eingetragen */
 
 #define FFL_SAVEMASK (FFL_DEFENDER|FFL_NEWID|FFL_NPC|FFL_DBENTRY|FFL_NOIDLEOUT)
 
-typedef struct faction {
-    struct faction *next;
-    struct faction *nexthash;
+    typedef struct faction {
+        struct faction *next;
+        struct faction *nexthash;
 
 #ifdef SMART_INTERVALS
-    struct region *first;
-    struct region *last;
+        struct region *first;
+        struct region *last;
 #endif
-    int no;
-    int subscription;
-    int flags;
-    char *name;
-    char *banner;
-    char *email;
-    char *passw;
-    int max_spelllevel;
-    struct spellbook *spellbook;
-    const struct locale *locale;
-    int lastorders;
-    int age;
-    struct ursprung *ursprung;
-    const struct race *race;
-    magic_t magiegebiet;
-    int newbies;
-    int num_people;             /* Anzahl Personen ohne Monster */
-    int num_total;              /* Anzahl Personen mit Monstern */
-    int options;
-    int no_units;
-    struct ally *allies;
-    struct group *groups;
-    int nregions;
-    int money;
+        int no;
+        int subscription;
+        int flags;
+        char *name;
+        char *banner;
+        char *email;
+        char *passw;
+        int max_spelllevel;
+        struct spellbook *spellbook;
+        const struct locale *locale;
+        int lastorders;
+        int age;
+        struct ursprung *ursprung;
+        const struct race *race;
+        magic_t magiegebiet;
+        int newbies;
+        int num_people;             /* Anzahl Personen ohne Monster */
+        int num_total;              /* Anzahl Personen mit Monstern */
+        int options;
+        int no_units;
+        struct ally *allies;
+        struct group *groups;
+        int nregions;
+        int money;
 #if SCORE_MODULE
-    int score;
+        int score;
 #endif
-    struct alliance *alliance;
-    int alliance_joindate;      /* the turn on which the faction joined its current alliance (or left the last one) */
+        struct alliance *alliance;
+        int alliance_joindate;      /* the turn on which the faction joined its current alliance (or left the last one) */
 #ifdef VICTORY_DELAY
-    unsigned char victory_delay;
+        unsigned char victory_delay;
 #endif
-    struct unit *units;
-    struct attrib *attribs;
-    struct message_list *msgs;
-    struct bmsg {
-      struct bmsg *next;
-      struct region *r;
-      struct message_list *msgs;
-    } *battles;
-    struct item *items;         /* items this faction can claim */
-    struct seen_region **seen;
-    struct quicklist *seen_factions;
-    bool alive;              /* enno: sollte ein flag werden */
-} faction;
+        struct unit *units;
+        struct attrib *attribs;
+        struct message_list *msgs;
+        struct bmsg {
+            struct bmsg *next;
+            struct region *r;
+            struct message_list *msgs;
+        } *battles;
+        struct item *items;         /* items this faction can claim */
+        struct seen_region **seen;
+        struct quicklist *seen_factions;
+        bool alive;              /* enno: sollte ein flag werden */
+    } faction;
 
-extern struct faction *factions;
+    extern struct faction *factions;
 
-void fhash(struct faction *f);
-void funhash(struct faction *f);
+    void fhash(struct faction *f);
+    void funhash(struct faction *f);
 
-struct faction *findfaction(int n);
-int max_magicians(const faction * f);
-void set_show_item(faction * f, const struct item_type *itype);
+    struct faction *findfaction(int n);
+    int max_magicians(const faction * f);
+    void set_show_item(faction * f, const struct item_type *itype);
 
-const struct unit *random_unit_in_faction(const struct faction *f);
-const char *factionname(const struct faction *f);
-struct unit *addplayer(struct region *r, faction * f);
-struct faction *addfaction(const char *email, const char *password,
-    const struct race *frace, const struct locale *loc, int subscription);
-bool checkpasswd(const faction * f, const char *passwd);
-void destroyfaction(faction * f);
+    const struct unit *random_unit_in_faction(const struct faction *f);
+    const char *factionname(const struct faction *f);
+    struct unit *addplayer(struct region *r, faction * f);
+    struct faction *addfaction(const char *email, const char *password,
+        const struct race *frace, const struct locale *loc, int subscription);
+    bool checkpasswd(const faction * f, const char *passwd);
+    void destroyfaction(faction * f);
 
-  extern void set_alliance(struct faction *a, struct faction *b, int status);
-  extern int get_alliance(const struct faction *a, const struct faction *b);
+    void set_alliance(struct faction *a, struct faction *b, int status);
+    int get_alliance(const struct faction *a, const struct faction *b);
 
-  extern struct alliance *f_get_alliance(const struct faction *f);
+    struct alliance *f_get_alliance(const struct faction *f);
 
-  extern void write_faction_reference(const struct faction *f,
-    struct storage *store);
-  extern variant read_faction_reference(struct storage *store);
-  extern int resolve_faction(variant data, void *addr);
+    void write_faction_reference(const struct faction *f,
+        struct storage *store);
+    variant read_faction_reference(struct storage *store);
+    int resolve_faction(variant data, void *addr);
 
-  extern void renumber_faction(faction * f, int no);
-  void free_faction(struct faction *f);
-  void remove_empty_factions(void);
+    void renumber_faction(faction * f, int no);
+    void free_faction(struct faction *f);
+    void remove_empty_factions(void);
 
 #ifdef SMART_INTERVALS
-  extern void update_interval(struct faction *f, struct region *r);
+    void update_interval(struct faction *f, struct region *r);
 #endif
 
-  const char *faction_getbanner(const struct faction *self);
-  void faction_setbanner(struct faction *self, const char *name);
+    const char *faction_getbanner(const struct faction *self);
+    void faction_setbanner(struct faction *self, const char *name);
 
-  const char *faction_getname(const struct faction *self);
-  void faction_setname(struct faction *self, const char *name);
+    const char *faction_getname(const struct faction *self);
+    void faction_setname(struct faction *self, const char *name);
 
-  const char *faction_getemail(const struct faction *self);
-  void faction_setemail(struct faction *self, const char *email);
+    const char *faction_getemail(const struct faction *self);
+    void faction_setemail(struct faction *self, const char *email);
 
-  const char *faction_getpassword(const struct faction *self);
-  void faction_setpassword(struct faction *self, const char *password);
-  bool valid_race(const struct faction *f, const struct race *rc);
+    const char *faction_getpassword(const struct faction *self);
+    void faction_setpassword(struct faction *self, const char *password);
+    bool valid_race(const struct faction *f, const struct race *rc);
 
-  struct spellbook * faction_get_spellbook(struct faction *f);
+    struct spellbook * faction_get_spellbook(struct faction *f);
 
-/* skills */
-  int skill_limit(struct faction *f, skill_t sk);
-  int count_skill(struct faction *f, skill_t sk);
+    /* skills */
+    int skill_limit(struct faction *f, skill_t sk);
+    int count_skill(struct faction *f, skill_t sk);
 
 #ifdef __cplusplus
 }
diff --git a/src/kernel/group.c b/src/kernel/group.c
index eeb0d4d42..43e34e058 100755
--- a/src/kernel/group.c
+++ b/src/kernel/group.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2014, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
@@ -198,7 +198,7 @@ bool join_group(unit * u, const char *name)
 void write_groups(struct storage *store, const faction * f)
 {
     group *g;
-    for (g = f->groups; g; g=g->next) {
+    for (g = f->groups; g; g = g->next) {
         ally *a;
         WRITE_INT(store, g->gid);
         WRITE_STR(store, g->name);
diff --git a/src/kernel/group.h b/src/kernel/group.h
index e4492d4ac..7ac0c31eb 100755
--- a/src/kernel/group.h
+++ b/src/kernel/group.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,28 +22,28 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  struct gamedata;
+    struct gamedata;
 
-  typedef struct group {
-    struct group *next;
-    struct group *nexthash;
-    struct faction *f;
-    struct attrib *attribs;
-    char *name;
-    struct ally *allies;
-    int gid;
-    int members;
-  } group;
+    typedef struct group {
+        struct group *next;
+        struct group *nexthash;
+        struct faction *f;
+        struct attrib *attribs;
+        char *name;
+        struct ally *allies;
+        int gid;
+        int members;
+    } group;
 
-  extern struct attrib_type at_group;   /* attribute for units assigned to a group */
-  extern bool join_group(struct unit *u, const char *name);
-  extern void set_group(struct unit *u, struct group *g);
-  extern struct group * get_group(const struct unit *u);
-  extern void free_group(struct group *g);
-  struct group *new_group(struct faction * f, const char *name, int gid);
+    extern struct attrib_type at_group;   /* attribute for units assigned to a group */
+    extern bool join_group(struct unit *u, const char *name);
+    extern void set_group(struct unit *u, struct group *g);
+    extern struct group * get_group(const struct unit *u);
+    extern void free_group(struct group *g);
+    struct group *new_group(struct faction * f, const char *name, int gid);
 
-  extern void write_groups(struct storage *data, const struct faction *f);
-  extern void read_groups(struct storage *data, struct faction *f);
+    extern void write_groups(struct storage *data, const struct faction *f);
+    extern void read_groups(struct storage *data, struct faction *f);
 
 #ifdef __cplusplus
 }
diff --git a/src/kernel/item.c b/src/kernel/item.c
index 584f8b0a2..12e461363 100644
--- a/src/kernel/item.c
+++ b/src/kernel/item.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
@@ -114,8 +114,8 @@ static int golem_factor(const unit *u, const resource_type *rtype) {
 static int res_changeitem(unit * u, const resource_type * rtype, int delta)
 {
     int num;
-    int gf = (delta>0) ? 0 : golem_factor(u, rtype);
-    if (gf>0) {
+    int gf = (delta > 0) ? 0 : golem_factor(u, rtype);
+    if (gf > 0) {
         if (delta != 0) {
             int reduce = delta / gf;
             if (delta % gf != 0) {
@@ -140,7 +140,7 @@ static int res_changeitem(unit * u, const resource_type * rtype, int delta)
 const char *resourcename(const resource_type * rtype, int flags)
 {
     if (!rtype)
-    assert(rtype);
+        assert(rtype);
     if (rtype) {
         if (rtype->name)
             return rtype->name(rtype, flags);
@@ -197,17 +197,17 @@ static void it_register(item_type * itype)
 }
 
 static const char *it_aliases[][2] = {
-        { "Runenschwert", "runesword" },
-        { "p12", "truthpotion" },
-        { "p1", "goliathwater" },
-        { "p4", "ointment" },
-        { "p5", "peasantblood" },
-        { "p8", "nestwarmth" },
-        { "diamond", "adamantium" },
-        { "diamondaxe", "adamantiumaxe" },
-        { "diamondplate", "adamantiumplate" },
-        { "aoh", "ao_healing" },
-        { NULL, NULL },
+    { "Runenschwert", "runesword" },
+    { "p12", "truthpotion" },
+    { "p1", "goliathwater" },
+    { "p4", "ointment" },
+    { "p5", "peasantblood" },
+    { "p8", "nestwarmth" },
+    { "diamond", "adamantium" },
+    { "diamondaxe", "adamantiumaxe" },
+    { "diamondplate", "adamantiumplate" },
+    { "aoh", "ao_healing" },
+    { NULL, NULL },
 };
 
 static const char *it_alias(const char *zname)
diff --git a/src/kernel/item.h b/src/kernel/item.h
index 9f2513134..089e4de87 100644
--- a/src/kernel/item.h
+++ b/src/kernel/item.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -36,82 +36,82 @@ extern "C" {
     struct item;
     struct order;
 
-  typedef struct item {
-    struct item *next;
-    const struct item_type *type;
-    int number;
-  } item;
+    typedef struct item {
+        struct item *next;
+        const struct item_type *type;
+        int number;
+    } item;
 
-  typedef struct resource {
-    const struct resource_type *type;
-    int number;
-    struct resource *next;
-  } resource;
+    typedef struct resource {
+        const struct resource_type *type;
+        int number;
+        struct resource *next;
+    } resource;
 
-/* bitfield values for resource_type::flags */
+    /* bitfield values for resource_type::flags */
 #define RTF_NONE     0
 #define RTF_ITEM     (1<<0)     /* this resource is an item */
 #define RTF_LIMITED  (1<<1)     /* a resource that's freely available, but in
-                                 * limited supply */
+                                     * limited supply */
 #define RTF_POOLED   (1<<2)     /* resource is available in pool */
 
-/* flags for resource_type::name() */
+    /* flags for resource_type::name() */
 #define NMF_PLURAL     0x01
 #define NMF_APPEARANCE 0x02
 
-  typedef int (*rtype_uchange) (struct unit * user,
-    const struct resource_type * rtype, int delta);
-  typedef int (*rtype_uget) (const struct unit * user,
-    const struct resource_type * rtype);
-  typedef char *(*rtype_name) (const struct resource_type * rtype, int flags);
-  typedef struct resource_type {
-    /* --- constants --- */
-    char *_name;             /* wie es hei�t */
-    unsigned int flags;
-    /* --- functions --- */
-    rtype_uchange uchange;
-    rtype_uget uget;
-    rtype_name name;
-    /* --- pointers --- */
-    struct attrib *attribs;
-    struct item_type *itype;
-    struct potion_type *ptype;
-    struct luxury_type *ltype;
-    struct weapon_type *wtype;
-    struct armor_type *atype;
-  } resource_type;
+    typedef int(*rtype_uchange) (struct unit * user,
+        const struct resource_type * rtype, int delta);
+    typedef int(*rtype_uget) (const struct unit * user,
+        const struct resource_type * rtype);
+    typedef char *(*rtype_name) (const struct resource_type * rtype, int flags);
+    typedef struct resource_type {
+        /* --- constants --- */
+        char *_name;             /* wie es hei�t */
+        unsigned int flags;
+        /* --- functions --- */
+        rtype_uchange uchange;
+        rtype_uget uget;
+        rtype_name name;
+        /* --- pointers --- */
+        struct attrib *attribs;
+        struct item_type *itype;
+        struct potion_type *ptype;
+        struct luxury_type *ltype;
+        struct weapon_type *wtype;
+        struct armor_type *atype;
+    } resource_type;
 
-  extern const char *resourcename(const resource_type * rtype, int flags);
-  extern const resource_type *findresourcetype(const char *name,
-    const struct locale *lang);
+    const char *resourcename(const resource_type * rtype, int flags);
+    const resource_type *findresourcetype(const char *name,
+        const struct locale *lang);
 
-/* resource-limits for regions */
+    /* resource-limits for regions */
 #define RMF_SKILL         0x01  /* int, bonus on resource production skill */
 #define RMF_SAVEMATERIAL  0x02  /* float, multiplier on resource usage */
 #define RMF_SAVERESOURCE  0x03  /* int, bonus on resource production skill */
 #define RMF_REQUIREDBUILDING 0x04       /* building, required to build */
 
-  typedef struct resource_mod {
-    variant value;
-    const struct building_type *btype;
-    const struct race *race;
-    unsigned int flags;
-  } resource_mod;
+    typedef struct resource_mod {
+        variant value;
+        const struct building_type *btype;
+        const struct race *race;
+        unsigned int flags;
+    } resource_mod;
 
-  extern struct attrib_type at_resourcelimit;
-  typedef int (*rlimit_limit) (const struct region * r,
-    const struct resource_type * rtype);
-  typedef void (*rlimit_produce) (struct region * r,
-    const struct resource_type * rtype, int n);
-  typedef struct resource_limit {
-    rlimit_limit limit;
-    rlimit_produce produce;
-    unsigned int guard;         /* how to guard against theft */
-    int value;
-    resource_mod *modifiers;
-  } resource_limit;
+    extern struct attrib_type at_resourcelimit;
+    typedef int(*rlimit_limit) (const struct region * r,
+        const struct resource_type * rtype);
+    typedef void(*rlimit_produce) (struct region * r,
+        const struct resource_type * rtype, int n);
+    typedef struct resource_limit {
+        rlimit_limit limit;
+        rlimit_produce produce;
+        unsigned int guard;         /* how to guard against theft */
+        int value;
+        resource_mod *modifiers;
+    } resource_limit;
 
-/* bitfield values for item_type::flags */
+    /* bitfield values for item_type::flags */
 #define ITF_NONE             0x0000
 #define ITF_HERB             0x0001     /* this item is a herb */
 #define ITF_CURSED           0x0002     /* cursed object, cannot be given away */
@@ -120,49 +120,49 @@ extern "C" {
 #define ITF_ANIMAL           0x0010     /* an animal */
 #define ITF_VEHICLE          0x0020     /* a vehicle, drawn by two animals */
 
-/* error codes for item_type::use */
+    /* error codes for item_type::use */
 #define ECUSTOM   -1
 #define ENOITEM   -2
 #define ENOSKILL  -3
 #define EUNUSABLE -4
 
-  typedef struct item_type {
-    resource_type *rtype;
-    /* --- constants --- */
-    unsigned int flags;
-    int weight;
-    int capacity;
-    struct construction *construction;
-    char *_appearance[2];       /* wie es f�r andere aussieht */
-    /* --- functions --- */
-     bool(*canuse) (const struct unit * user,
-      const struct item_type * itype);
-    int (*use) (struct unit * user, const struct item_type * itype, int amount,
-      struct order * ord);
-    int (*useonother) (struct unit * user, int targetno,
-      const struct item_type * itype, int amount, struct order * ord);
-    int (*give) (struct unit * src, struct unit * dest,
-      const struct item_type * itm, int number, struct order * ord);
+    typedef struct item_type {
+        resource_type *rtype;
+        /* --- constants --- */
+        unsigned int flags;
+        int weight;
+        int capacity;
+        struct construction *construction;
+        char *_appearance[2];       /* wie es f�r andere aussieht */
+        /* --- functions --- */
+        bool(*canuse) (const struct unit * user,
+            const struct item_type * itype);
+        int(*use) (struct unit * user, const struct item_type * itype, int amount,
+        struct order * ord);
+        int(*useonother) (struct unit * user, int targetno,
+            const struct item_type * itype, int amount, struct order * ord);
+        int(*give) (struct unit * src, struct unit * dest,
+            const struct item_type * itm, int number, struct order * ord);
 #if SCORE_MODULE
-    int score;
+        int score;
 #endif
-  } item_type;
+    } item_type;
 
-  extern const item_type *finditemtype(const char *name, const struct locale *lang);
+    const item_type *finditemtype(const char *name, const struct locale *lang);
 
-  typedef struct luxury_type {
-    struct luxury_type *next;
-    const item_type *itype;
-    int price;
-  } luxury_type;
-  extern luxury_type *luxurytypes;
+    typedef struct luxury_type {
+        struct luxury_type *next;
+        const item_type *itype;
+        int price;
+    } luxury_type;
+    extern luxury_type *luxurytypes;
 
-  typedef struct potion_type {
-    struct potion_type *next;
-    const item_type *itype;
-    int level;
-  } potion_type;
-  extern potion_type *potiontypes;
+    typedef struct potion_type {
+        struct potion_type *next;
+        const item_type *itype;
+        int level;
+    } potion_type;
+    extern potion_type *potiontypes;
 
 #define WMF_WALKING         0x0001
 #define WMF_RIDING          0x0002
@@ -180,25 +180,25 @@ extern "C" {
 #define WMF_SKILL           0x2000
 #define WMF_MISSILE_TARGET  0x4000
 
-  struct race_list;
-  typedef struct weapon_mod {
-    int value;
-    unsigned int flags;
-    struct race_list *races;
-  } weapon_mod;
+    struct race_list;
+    typedef struct weapon_mod {
+        int value;
+        unsigned int flags;
+        struct race_list *races;
+    } weapon_mod;
 
 #define ATF_NONE   0x00
 #define ATF_SHIELD 0x01
 #define ATF_LAEN   0x02
 
-  typedef struct armor_type {
-    const item_type *itype;
-    unsigned int flags;
-    double penalty;
-    double magres;
-    int prot;
-    float projectile;           /* chance, dass ein projektil abprallt */
-  } armor_type;
+    typedef struct armor_type {
+        const item_type *itype;
+        unsigned int flags;
+        double penalty;
+        double magres;
+        int prot;
+        float projectile;           /* chance, dass ein projektil abprallt */
+    } armor_type;
 
 #define WTF_NONE          0x00
 #define WTF_MISSILE       0x01
@@ -211,120 +211,120 @@ extern "C" {
 #define WTF_HORSEBONUS    0x80
 #define WTF_USESHIELD     0x100
 
-  typedef struct weapon_type {
-    const item_type *itype;
-    const char *damage[2];
-    unsigned int flags;
-    skill_t skill;
-    int minskill;
-    int offmod;
-    int defmod;
-    double magres;
-    int reload;                 /* time to reload this weapon */
-    weapon_mod *modifiers;
-    /* --- functions --- */
-    bool(*attack) (const struct troop *, const struct weapon_type *,
-      int *deaths);
-  } weapon_type;
+    typedef struct weapon_type {
+        const item_type *itype;
+        const char *damage[2];
+        unsigned int flags;
+        skill_t skill;
+        int minskill;
+        int offmod;
+        int defmod;
+        double magres;
+        int reload;                 /* time to reload this weapon */
+        weapon_mod *modifiers;
+        /* --- functions --- */
+        bool(*attack) (const struct troop *, const struct weapon_type *,
+            int *deaths);
+    } weapon_type;
 
-  resource_type *rt_find(const char *name);
-  item_type *it_find(const char *name);
+    resource_type *rt_find(const char *name);
+    item_type *it_find(const char *name);
 
-  void it_set_appearance(item_type *itype, const char *appearance);
+    void it_set_appearance(item_type *itype, const char *appearance);
 
-  extern const item_type *resource2item(const resource_type * rtype);
-  extern const resource_type *item2resource(const item_type * i);
+    const item_type *resource2item(const resource_type * rtype);
+    const resource_type *item2resource(const item_type * i);
 
-  extern const weapon_type *resource2weapon(const resource_type * i);
-  extern const potion_type *resource2potion(const resource_type * i);
-  extern const luxury_type *resource2luxury(const resource_type * i);
+    const weapon_type *resource2weapon(const resource_type * i);
+    const potion_type *resource2potion(const resource_type * i);
+    const luxury_type *resource2luxury(const resource_type * i);
 
-  extern item **i_find(item ** pi, const item_type * it);
-  extern item *const *i_findc(item * const *pi, const item_type * it);
-  extern item *i_add(item ** pi, item * it);
-  extern void i_merge(item ** pi, item ** si);
-  extern item *i_remove(item ** pi, item * it);
-  extern void i_free(item * i);
-  extern void i_freeall(item ** i);
-  extern item *i_new(const item_type * it, int number);
+    item **i_find(item ** pi, const item_type * it);
+    item *const *i_findc(item * const *pi, const item_type * it);
+    item *i_add(item ** pi, item * it);
+    void i_merge(item ** pi, item ** si);
+    item *i_remove(item ** pi, item * it);
+    void i_free(item * i);
+    void i_freeall(item ** i);
+    item *i_new(const item_type * it, int number);
 
-/* convenience: */
-  extern item *i_change(item ** items, const item_type * it, int delta);
-  extern int i_get(const item * i, const item_type * it);
+    /* convenience: */
+    item *i_change(item ** items, const item_type * it, int delta);
+    int i_get(const item * i, const item_type * it);
 
-/* creation */
+    /* creation */
     resource_type *rt_get_or_create(const char *name);
     item_type *it_get_or_create(resource_type *rtype);
-  extern item_type *new_itemtype(resource_type * rtype, int iflags, int weight,
-    int capacity);
-  extern luxury_type *new_luxurytype(item_type * itype, int price);
-  extern weapon_type *new_weapontype(item_type * itype, int wflags,
-    double magres, const char *damage[], int offmod, int defmod, int reload,
-    skill_t sk, int minskill);
-  extern armor_type *new_armortype(item_type * itype, double penalty,
-    double magres, int prot, unsigned int flags);
-  extern potion_type *new_potiontype(item_type * itype, int level);
+    item_type *new_itemtype(resource_type * rtype, int iflags, int weight,
+        int capacity);
+    luxury_type *new_luxurytype(item_type * itype, int price);
+    weapon_type *new_weapontype(item_type * itype, int wflags,
+        double magres, const char *damage[], int offmod, int defmod, int reload,
+        skill_t sk, int minskill);
+    armor_type *new_armortype(item_type * itype, double penalty,
+        double magres, int prot, unsigned int flags);
+    potion_type *new_potiontype(item_type * itype, int level);
 
-  typedef enum {
-    /* ITEMS: */
-    R_IRON,
-    R_STONE,
-    R_HORSE,
-    R_AMULET_OF_HEALING,
-    R_AMULET_OF_TRUE_SEEING,
-    R_RING_OF_INVISIBILITY,
-    R_RING_OF_POWER,
-    R_CHASTITY_BELT,
-    R_EOG,
-    R_FEENSTIEFEL,
-    R_BIRTHDAYAMULET,
-    R_PEGASUS,
-    R_UNICORN,
-    R_CHARGER,
-    R_DOLPHIN,
-    R_RING_OF_NIMBLEFINGER,
-    R_TROLLBELT,
-    R_AURAKULUM,
-    R_SPHERE_OF_INVISIBILITY,
-    R_BAG_OF_HOLDING,
-    R_SACK_OF_CONSERVATION,
-    R_TACTICCRYSTAL,
-    R_WATER_OF_LIFE,
-    R_SEED,
-    R_MALLORNSEED,
-    /* SONSTIGE */
-    R_SILVER,
-    R_AURA,                     /* Aura */
-    R_PERMAURA,                 /* Permanente Aura */
-    R_LIFE,
-    R_PEASANT,
-    R_PERSON,
+    typedef enum {
+        /* ITEMS: */
+        R_IRON,
+        R_STONE,
+        R_HORSE,
+        R_AMULET_OF_HEALING,
+        R_AMULET_OF_TRUE_SEEING,
+        R_RING_OF_INVISIBILITY,
+        R_RING_OF_POWER,
+        R_CHASTITY_BELT,
+        R_EOG,
+        R_FEENSTIEFEL,
+        R_BIRTHDAYAMULET,
+        R_PEGASUS,
+        R_UNICORN,
+        R_CHARGER,
+        R_DOLPHIN,
+        R_RING_OF_NIMBLEFINGER,
+        R_TROLLBELT,
+        R_AURAKULUM,
+        R_SPHERE_OF_INVISIBILITY,
+        R_BAG_OF_HOLDING,
+        R_SACK_OF_CONSERVATION,
+        R_TACTICCRYSTAL,
+        R_WATER_OF_LIFE,
+        R_SEED,
+        R_MALLORNSEED,
+        /* SONSTIGE */
+        R_SILVER,
+        R_AURA,                     /* Aura */
+        R_PERMAURA,                 /* Permanente Aura */
+        R_LIFE,
+        R_PEASANT,
+        R_PERSON,
 
-    MAX_RESOURCES,              /* do not use outside item.c ! */
-    NORESOURCE = -1
-  } resource_t;
+        MAX_RESOURCES,              /* do not use outside item.c ! */
+        NORESOURCE = -1
+    } resource_t;
 
-  extern const struct potion_type *oldpotiontype[];
-  const struct resource_type *get_resourcetype(resource_t rt);
+    extern const struct potion_type *oldpotiontype[];
+    const struct resource_type *get_resourcetype(resource_t rt);
 
-  int get_money(const struct unit *);
-  int set_money(struct unit *, int);
-  int change_money(struct unit *, int);
+    int get_money(const struct unit *);
+    int set_money(struct unit *, int);
+    int change_money(struct unit *, int);
 
-  extern struct attrib_type at_showitem;        /* show this potion's description */
+    extern struct attrib_type at_showitem;        /* show this potion's description */
 
-  void register_resources(void);
-  void init_resources(void);
-  void init_itemtypes(void);
+    void register_resources(void);
+    void init_resources(void);
+    void init_itemtypes(void);
 
-  extern void register_item_give(int (*foo) (struct unit *, struct unit *,
-      const struct item_type *, int, struct order *), const char *name);
-  extern void register_item_use(int (*foo) (struct unit *,
-      const struct item_type *, int, struct order *), const char *name);
-  extern void register_item_useonother(int (*foo) (struct unit *, int,
-      const struct item_type *, int, struct order *), const char *name);
+    void register_item_give(int(*foo) (struct unit *, struct unit *,
+        const struct item_type *, int, struct order *), const char *name);
+    void register_item_use(int(*foo) (struct unit *,
+        const struct item_type *, int, struct order *), const char *name);
+    void register_item_useonother(int(*foo) (struct unit *, int,
+        const struct item_type *, int, struct order *), const char *name);
 
-  void free_resources(void);
+    void free_resources(void);
 
 #ifdef __cplusplus
 }
diff --git a/src/kernel/item.test.c b/src/kernel/item.test.c
index dcb7ca878..9ad54c8e2 100644
--- a/src/kernel/item.test.c
+++ b/src/kernel/item.test.c
@@ -25,7 +25,7 @@ static void test_resourcename_no_appearance(CuTest *tc) {
     CuAssertStrEquals(tc, "money", resourcename(rtype, 0));
     CuAssertStrEquals(tc, "money_p", resourcename(rtype, NMF_PLURAL));
     CuAssertStrEquals(tc, "money", resourcename(rtype, NMF_APPEARANCE));
-    CuAssertStrEquals(tc, "money_p", resourcename(rtype, NMF_APPEARANCE|NMF_PLURAL));
+    CuAssertStrEquals(tc, "money_p", resourcename(rtype, NMF_APPEARANCE | NMF_PLURAL));
     test_cleanup();
 }
 
@@ -44,78 +44,78 @@ static void test_resourcename_with_appearance(CuTest *tc) {
 }
 
 static void test_uchange(CuTest * tc, unit * u, const resource_type * rtype) {
-  int n;
-  change_resource(u, rtype, 4);
-  n = get_resource(u, rtype);
-  CuAssertPtrNotNull(tc, rtype->uchange);
-  CuAssertIntEquals(tc, n, rtype->uchange(u, rtype, 0));
-  CuAssertIntEquals(tc, n-3, rtype->uchange(u, rtype, -3));
-  CuAssertIntEquals(tc, n-3, get_resource(u, rtype));
-  CuAssertIntEquals(tc, 0, rtype->uchange(u, rtype, -n));
+    int n;
+    change_resource(u, rtype, 4);
+    n = get_resource(u, rtype);
+    CuAssertPtrNotNull(tc, rtype->uchange);
+    CuAssertIntEquals(tc, n, rtype->uchange(u, rtype, 0));
+    CuAssertIntEquals(tc, n - 3, rtype->uchange(u, rtype, -3));
+    CuAssertIntEquals(tc, n - 3, get_resource(u, rtype));
+    CuAssertIntEquals(tc, 0, rtype->uchange(u, rtype, -n));
 }
 
 void test_change_item(CuTest * tc)
 {
-  unit * u;
+    unit * u;
 
-  test_cleanup();
-  init_resources();
-  test_create_world();
+    test_cleanup();
+    init_resources();
+    test_create_world();
 
-  u = test_create_unit(0, 0);
-  test_uchange(tc, u, get_resourcetype(R_IRON));
+    u = test_create_unit(0, 0);
+    test_uchange(tc, u, get_resourcetype(R_IRON));
 }
 
 void test_resource_type(CuTest * tc)
 {
-  struct item_type *itype;
+    struct item_type *itype;
 
-  test_cleanup();
+    test_cleanup();
 
-  CuAssertPtrEquals(tc, 0, rt_find("herpderp"));
+    CuAssertPtrEquals(tc, 0, rt_find("herpderp"));
 
-  test_create_itemtype("herpderp");
-  test_create_itemtype("herpes");
-  itype = test_create_itemtype("herp");
+    test_create_itemtype("herpderp");
+    test_create_itemtype("herpes");
+    itype = test_create_itemtype("herp");
 
-  CuAssertPtrEquals(tc, itype->rtype, rt_find("herp"));
+    CuAssertPtrEquals(tc, itype->rtype, rt_find("herp"));
 }
 
 void test_finditemtype(CuTest * tc)
 {
-  const item_type *itype;
-  const resource_type *rtype;
-  struct locale * lang;
+    const item_type *itype;
+    const resource_type *rtype;
+    struct locale * lang;
 
-  test_cleanup();
-  test_create_world();
+    test_cleanup();
+    test_create_world();
 
-  lang = get_locale("de");
-  locale_setstring(lang, "horse", "Pferd");
-  rtype = get_resourcetype(R_HORSE);
-  itype = finditemtype("Pferd", lang);
-  CuAssertPtrNotNull(tc, itype);
-  CuAssertPtrEquals(tc, (void*)rtype->itype, (void*)itype);
+    lang = get_locale("de");
+    locale_setstring(lang, "horse", "Pferd");
+    rtype = get_resourcetype(R_HORSE);
+    itype = finditemtype("Pferd", lang);
+    CuAssertPtrNotNull(tc, itype);
+    CuAssertPtrEquals(tc, (void*)rtype->itype, (void*)itype);
 }
 
 void test_findresourcetype(CuTest * tc)
 {
-  const resource_type *rtype, *rresult;
-  struct locale * lang;
+    const resource_type *rtype, *rresult;
+    struct locale * lang;
 
-  test_cleanup();
-  test_create_world();
+    test_cleanup();
+    test_create_world();
 
-  lang = get_locale("de");
-  locale_setstring(lang, "horse", "Pferd");
-  locale_setstring(lang, "peasant", "Bauer");
+    lang = get_locale("de");
+    locale_setstring(lang, "horse", "Pferd");
+    locale_setstring(lang, "peasant", "Bauer");
 
-  rtype = get_resourcetype(R_HORSE);
-  rresult = findresourcetype("Pferd", lang);
-  CuAssertPtrNotNull(tc, rresult);
-  CuAssertPtrEquals(tc, (void*)rtype, (void*)rresult);
+    rtype = get_resourcetype(R_HORSE);
+    rresult = findresourcetype("Pferd", lang);
+    CuAssertPtrNotNull(tc, rresult);
+    CuAssertPtrEquals(tc, (void*)rtype, (void*)rresult);
 
-  CuAssertPtrNotNull(tc, findresourcetype("Bauer", lang));
+    CuAssertPtrNotNull(tc, findresourcetype("Bauer", lang));
 }
 
 #include <modules/autoseed.h>
@@ -145,13 +145,13 @@ static void test_fix_demand(CuTest *tc) {
 
 CuSuite *get_item_suite(void)
 {
-  CuSuite *suite = CuSuiteNew();
-  SUITE_ADD_TEST(suite, test_resourcename_no_appearance);
-  SUITE_ADD_TEST(suite, test_resourcename_with_appearance);
-  SUITE_ADD_TEST(suite, test_change_item);
-  SUITE_ADD_TEST(suite, test_resource_type);
-  SUITE_ADD_TEST(suite, test_finditemtype);
-  SUITE_ADD_TEST(suite, test_findresourcetype);
-  SUITE_ADD_TEST(suite, test_fix_demand);
-  return suite;
+    CuSuite *suite = CuSuiteNew();
+    SUITE_ADD_TEST(suite, test_resourcename_no_appearance);
+    SUITE_ADD_TEST(suite, test_resourcename_with_appearance);
+    SUITE_ADD_TEST(suite, test_change_item);
+    SUITE_ADD_TEST(suite, test_resource_type);
+    SUITE_ADD_TEST(suite, test_finditemtype);
+    SUITE_ADD_TEST(suite, test_findresourcetype);
+    SUITE_ADD_TEST(suite, test_fix_demand);
+    return suite;
 }
diff --git a/src/kernel/jsonconf.c b/src/kernel/jsonconf.c
index cf2a988e7..1b6995778 100644
--- a/src/kernel/jsonconf.c
+++ b/src/kernel/jsonconf.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/*
 +-------------------+
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Christian Schlittchen <corwin@amber.kn-bremen.de>
@@ -55,13 +55,13 @@ without prior permission by the authors of Eressea.
 static int json_flags(cJSON *json, const char *flags[]) {
     cJSON *entry;
     int result = 0;
-    assert(json->type==cJSON_Array);
-    for (entry=json->child;entry;entry=entry->next) {
+    assert(json->type == cJSON_Array);
+    for (entry = json->child; entry; entry = entry->next) {
         if (entry->type == cJSON_String) {
             int i;
             for (i = 0; flags[i]; ++i) {
-                if (strcmp(flags[i], entry->valuestring)==0) {
-                    result |= (1<<i);
+                if (strcmp(flags[i], entry->valuestring) == 0) {
+                    result |= (1 << i);
                 }
             }
         }
@@ -72,8 +72,8 @@ static int json_flags(cJSON *json, const char *flags[]) {
 static void json_requirements(cJSON *json, requirement **matp) {
     cJSON *child;
     int i;
-    requirement *mat = calloc(sizeof(requirement), 1+cJSON_GetArraySize(json));
-    for (i=0,child=json->child;child;child=child->next,++i) {
+    requirement *mat = calloc(sizeof(requirement), 1 + cJSON_GetArraySize(json));
+    for (i = 0, child = json->child; child; child = child->next, ++i) {
         mat[i].number = child->valueint;
         mat[i].rtype = rt_get_or_create(child->string);
     }
@@ -131,7 +131,7 @@ static void json_maintenance(cJSON *json, maintenance **mtp) {
     if (json->type == cJSON_Array) {
         for (i = 0, child = json->child; child; child = child->next, ++i) {
             if (child->type == cJSON_Object) {
-                json_maintenance_i(child, mt+i);
+                json_maintenance_i(child, mt + i);
             }
         }
     }
@@ -140,9 +140,9 @@ static void json_maintenance(cJSON *json, maintenance **mtp) {
 
 static void json_construction(cJSON *json, construction **consp) {
     cJSON *child;
-    if (json->type==cJSON_Array) {
+    if (json->type == cJSON_Array) {
         int size = 0;
-        for (child=json->child;child;child=child->next) {
+        for (child = json->child; child; child = child->next) {
             construction *cons = 0;
             json_construction(child, &cons);
             if (cons) {
@@ -159,24 +159,24 @@ static void json_construction(cJSON *json, construction **consp) {
         return;
     }
     construction * cons = (construction *)calloc(sizeof(construction), 1);
-    for (child=json->child;child;child=child->next) {
-        switch(child->type) {
+    for (child = json->child; child; child = child->next) {
+        switch (child->type) {
         case cJSON_Object:
-            if (strcmp(child->string, "materials")==0) {
+            if (strcmp(child->string, "materials") == 0) {
                 json_requirements(child, &cons->materials);
             }
             break;
         case cJSON_Number:
-            if (strcmp(child->string, "maxsize")==0) {
+            if (strcmp(child->string, "maxsize") == 0) {
                 cons->maxsize = child->valueint;
             }
-            else if (strcmp(child->string, "reqsize")==0) {
+            else if (strcmp(child->string, "reqsize") == 0) {
                 cons->reqsize = child->valueint;
             }
-            else if (strcmp(child->string, "minskill")==0) {
+            else if (strcmp(child->string, "minskill") == 0) {
                 cons->minskill = child->valueint;
             }
-            break; 
+            break;
         default:
             log_error("construction %s contains unknown attribute %s", json->string, child->string);
         }
@@ -186,19 +186,20 @@ static void json_construction(cJSON *json, construction **consp) {
 
 static void json_terrain(cJSON *json, terrain_type *ter) {
     cJSON *child;
-    if (json->type!=cJSON_Object) {
+    if (json->type != cJSON_Object) {
         log_error("terrain %s is not a json object: %d", json->string, json->type);
         return;
     }
-    for (child=json->child;child;child=child->next) {
-        switch(child->type) {
+    for (child = json->child; child; child = child->next) {
+        switch (child->type) {
         case cJSON_Array:
-            if (strcmp(child->string, "flags")==0) {
+            if (strcmp(child->string, "flags") == 0) {
                 const char * flags[] = {
                     "land", "sea", "forest", "arctic", "cavalry", "forbidden", "sail", "fly", "swim", "walk", 0
                 };
                 ter->flags = json_flags(child, flags);
-            } else {
+            }
+            else {
                 log_error("terrain %s contains unknown attribute %s", json->string, child->string);
             }
             break;
@@ -217,8 +218,8 @@ static void json_building(cJSON *json, building_type *bt) {
         log_error("building %s is not a json object: %d", json->string, json->type);
         return;
     }
-    for (child=json->child;child;child=child->next) {
-        switch(child->type) {
+    for (child = json->child; child; child = child->next) {
+        switch (child->type) {
         case cJSON_Array:
             if (strcmp(child->string, "construction") == 0) {
                 json_construction(child, &bt->construction);
@@ -231,7 +232,7 @@ static void json_building(cJSON *json, building_type *bt) {
             }
             break;
         case cJSON_Object:
-            if (strcmp(child->string, "construction")==0) {
+            if (strcmp(child->string, "construction") == 0) {
                 json_construction(child, &bt->construction);
             }
             else if (strcmp(child->string, "maintenance") == 0) {
@@ -239,9 +240,9 @@ static void json_building(cJSON *json, building_type *bt) {
             }
             break;
         case cJSON_String:
-            if (strcmp(child->string, "name")==0) {
+            if (strcmp(child->string, "name") == 0) {
                 bt->name = (const char *(*)(const struct building_type *,
-                                            const struct building *, int))get_function(child->valuestring);
+                    const struct building *, int))get_function(child->valuestring);
                 break;
             }
             log_error("building %s contains unknown attribute %s", json->string, child->string);
@@ -257,25 +258,25 @@ static void json_item(cJSON *json, item_type *itype) {
     const char *flags[] = {
         "herb", "cursed", "nodrop", "big", "animal", "vehicle", 0
     };
-    if (json->type!=cJSON_Object) {
+    if (json->type != cJSON_Object) {
         log_error("ship %s is not a json object: %d", json->string, json->type);
         return;
     }
-    for (child=json->child;child;child=child->next) {
-        switch(child->type) {
+    for (child = json->child; child; child = child->next) {
+        switch (child->type) {
         case cJSON_Number:
-            if (strcmp(child->string, "weight")==0) {
+            if (strcmp(child->string, "weight") == 0) {
                 itype->weight = child->valueint;
                 break;
             }
-            if (strcmp(child->string, "capacity")==0) {
+            if (strcmp(child->string, "capacity") == 0) {
                 itype->capacity = child->valueint;
                 break;
             }
             log_error("item %s contains unknown attribute %s", json->string, child->string);
             break;
         case cJSON_Array:
-            if (strcmp(child->string, "flags")==0) {
+            if (strcmp(child->string, "flags") == 0) {
                 itype->flags = json_flags(child, flags);
                 break;
             }
@@ -289,25 +290,26 @@ static void json_item(cJSON *json, item_type *itype) {
 
 static void json_ship(cJSON *json, ship_type *st) {
     cJSON *child, *iter;
-    if (json->type!=cJSON_Object) {
+    if (json->type != cJSON_Object) {
         log_error("ship %s is not a json object: %d", json->string, json->type);
         return;
     }
-    for (child=json->child;child;child=child->next) {
+    for (child = json->child; child; child = child->next) {
         int i;
-        switch(child->type) {
+        switch (child->type) {
         case cJSON_Object:
-            if (strcmp(child->string, "construction")==0) {
+            if (strcmp(child->string, "construction") == 0) {
                 json_construction(child, &st->construction);
-            } else {
+            }
+            else {
                 log_error("ship %s contains unknown attribute %s", json->string, child->string);
             }
             break;
         case cJSON_Array:
             st->coasts = (terrain_type **)
-                malloc(sizeof(terrain_type *) * (1+cJSON_GetArraySize(child)));
-            for (i=0,iter=child->child;iter;iter=iter->next) {
-                if (iter->type==cJSON_String) {
+                malloc(sizeof(terrain_type *) * (1 + cJSON_GetArraySize(child)));
+            for (i = 0, iter = child->child; iter; iter = iter->next) {
+                if (iter->type == cJSON_String) {
                     terrain_type *ter = get_or_create_terrain(iter->valuestring);
                     if (ter) {
                         st->coasts[i++] = ter;
@@ -317,9 +319,10 @@ static void json_ship(cJSON *json, ship_type *st) {
             st->coasts[i] = 0;
             break;
         case cJSON_Number:
-            if (strcmp(child->string, "range")==0) {
+            if (strcmp(child->string, "range") == 0) {
                 st->range = child->valueint;
-            } else {
+            }
+            else {
                 log_error("ship %s contains unknown attribute %s", json->string, child->string);
             }
             break;
@@ -336,7 +339,7 @@ static void json_race(cJSON *json, race *rc) {
         "nosteal", "moverandom", "cannotmove",
         "learn", "fly", "swim", "walk", "nolearn",
         "noteach", "horse", "desert",
-        "illusionary", "absorbpeasants", "noheal", 
+        "illusionary", "absorbpeasants", "noheal",
         "noweapons", "shapeshift", "", "undead", "dragon",
         "coastal", "", "cansail", 0
     };
@@ -348,48 +351,48 @@ static void json_race(cJSON *json, race *rc) {
         log_error("race %s is not a json object: %d", json->string, json->type);
         return;
     }
-    for (child=json->child;child;child=child->next) {
-        switch(child->type) {
+    for (child = json->child; child; child = child->next) {
+        switch (child->type) {
         case cJSON_String:
-            if (strcmp(child->string, "damage")==0) {
+            if (strcmp(child->string, "damage") == 0) {
                 rc->def_damage = _strdup(child->valuestring);
             }
             break;
         case cJSON_Number:
-            if (strcmp(child->string, "magres")==0) {
+            if (strcmp(child->string, "magres") == 0) {
                 rc->magres = (float)child->valuedouble;
             }
-            else if (strcmp(child->string, "maxaura")==0) {
+            else if (strcmp(child->string, "maxaura") == 0) {
                 rc->maxaura = (float)child->valuedouble;
             }
-            else if (strcmp(child->string, "regaura")==0) {
+            else if (strcmp(child->string, "regaura") == 0) {
                 rc->regaura = (float)child->valuedouble;
             }
-            else if (strcmp(child->string, "speed")==0) {
+            else if (strcmp(child->string, "speed") == 0) {
                 rc->speed = (float)child->valuedouble;
             }
-            else if (strcmp(child->string, "recruitcost")==0) {
+            else if (strcmp(child->string, "recruitcost") == 0) {
                 rc->recruitcost = child->valueint;
             }
-            else if (strcmp(child->string, "maintenance")==0) {
+            else if (strcmp(child->string, "maintenance") == 0) {
                 rc->maintenance = child->valueint;
             }
-            else if (strcmp(child->string, "weight")==0) {
+            else if (strcmp(child->string, "weight") == 0) {
                 rc->weight = child->valueint;
             }
-            else if (strcmp(child->string, "capacity")==0) {
+            else if (strcmp(child->string, "capacity") == 0) {
                 rc->capacity = child->valueint;
             }
-            else if (strcmp(child->string, "hp")==0) {
+            else if (strcmp(child->string, "hp") == 0) {
                 rc->hitpoints = child->valueint;
             }
-            else if (strcmp(child->string, "ac")==0) {
+            else if (strcmp(child->string, "ac") == 0) {
                 rc->armor = child->valueint;
             }
             // TODO: studyspeed (orcs only)
             break;
         case cJSON_Array:
-            if (strcmp(child->string, "flags")==0) {
+            if (strcmp(child->string, "flags") == 0) {
                 rc->flags = json_flags(child, flags);
                 rc->ec_flags = json_flags(child, ecflags);
             }
@@ -400,22 +403,22 @@ static void json_race(cJSON *json, race *rc) {
 
 static void json_terrains(cJSON *json) {
     cJSON *child;
-    if (json->type!=cJSON_Object) {
+    if (json->type != cJSON_Object) {
         log_error("terrains is not a json object: %d", json->type);
         return;
     }
-    for (child=json->child;child;child=child->next) {
+    for (child = json->child; child; child = child->next) {
         json_terrain(child, get_or_create_terrain(child->string));
     }
 }
 
 static void json_buildings(cJSON *json) {
     cJSON *child;
-    if (json->type!=cJSON_Object) {
+    if (json->type != cJSON_Object) {
         log_error("buildings is not a json object: %d", json->type);
         return;
     }
-    for (child=json->child;child;child=child->next) {
+    for (child = json->child; child; child = child->next) {
         json_building(child, bt_get_or_create(child->string));
     }
 }
@@ -451,11 +454,11 @@ static void json_spells(cJSON *json) {
 
 static void json_items(cJSON *json) {
     cJSON *child;
-    if (json->type!=cJSON_Object) {
+    if (json->type != cJSON_Object) {
         log_error("items is not a json object: %d", json->type);
         return;
     }
-    for (child=json->child;child;child=child->next) {
+    for (child = json->child; child; child = child->next) {
         resource_type *rtype = rt_get_or_create(child->string);
         item_type *itype = rtype->itype;
         if (!itype) {
@@ -467,23 +470,23 @@ static void json_items(cJSON *json) {
 
 static void json_ships(cJSON *json) {
     cJSON *child;
-    if (json->type!=cJSON_Object) {
+    if (json->type != cJSON_Object) {
         log_error("ships is not a json object: %d", json->type);
         return;
     }
-    for (child=json->child;child;child=child->next) {
+    for (child = json->child; child; child = child->next) {
         json_ship(child, st_get_or_create(child->string));
     }
 }
 
 static void json_locale(cJSON *json, struct locale *lang) {
     cJSON *child;
-    if (json->type!=cJSON_Object) {
+    if (json->type != cJSON_Object) {
         log_error("strings is not a json object: %d", json->type);
         return;
     }
-    for (child=json->child;child;child=child->next) {
-        if (child->type==cJSON_String) {
+    for (child = json->child; child; child = child->next) {
+        if (child->type == cJSON_String) {
             locale_setstring(lang, child->string, child->valuestring);
         }
     }
@@ -491,15 +494,16 @@ static void json_locale(cJSON *json, struct locale *lang) {
 
 static void json_strings(cJSON *json) {
     cJSON *child;
-    if (json->type!=cJSON_Object) {
+    if (json->type != cJSON_Object) {
         log_error("strings is not a json object: %d", json->type);
         return;
     }
-    for (child=json->child;child;child=child->next) {
-        if (child->type==cJSON_Object) {
-            struct locale *lang = get_or_create_locale(child->string); 
+    for (child = json->child; child; child = child->next) {
+        if (child->type == cJSON_Object) {
+            struct locale *lang = get_or_create_locale(child->string);
             json_locale(child, lang);
-        } else {
+        }
+        else {
             log_error("strings for locale `%s` are not a json object: %d", child->string, child->type);
         }
     }
@@ -507,22 +511,23 @@ static void json_strings(cJSON *json) {
 
 static void json_direction(cJSON *json, struct locale *lang) {
     cJSON *child;
-    if (json->type!=cJSON_Object) {
+    if (json->type != cJSON_Object) {
         log_error("directions for locale `%s` not a json object: %d", locale_name(lang), json->type);
         return;
     }
-    for (child=json->child;child;child=child->next) {
+    for (child = json->child; child; child = child->next) {
         direction_t dir = finddirection(child->string);
-        if (dir!=NODIRECTION) {
-            if (child->type==cJSON_String) {
+        if (dir != NODIRECTION) {
+            if (child->type == cJSON_String) {
                 init_direction(lang, dir, child->valuestring);
             }
-            else if (child->type==cJSON_Array) {
+            else if (child->type == cJSON_Array) {
                 cJSON *entry;
-                for (entry=child->child;entry;entry=entry->next) {
+                for (entry = child->child; entry; entry = entry->next) {
                     init_direction(lang, dir, entry->valuestring);
                 }
-            } else {
+            }
+            else {
                 log_error("invalid type %d for direction `%s`", child->type, child->string);
             }
         }
@@ -531,11 +536,11 @@ static void json_direction(cJSON *json, struct locale *lang) {
 
 static void json_directions(cJSON *json) {
     cJSON *child;
-    if (json->type!=cJSON_Object) {
+    if (json->type != cJSON_Object) {
         log_error("directions is not a json object: %d", json->type);
         return;
     }
-    for (child=json->child;child;child=child->next) {
+    for (child = json->child; child; child = child->next) {
         struct locale * lang = get_or_create_locale(child->string);
         json_direction(child, lang);
     }
@@ -543,29 +548,31 @@ static void json_directions(cJSON *json) {
 
 static void json_skill(cJSON *json, struct locale *lang) {
     cJSON *child;
-    if (json->type!=cJSON_Object) {
+    if (json->type != cJSON_Object) {
         log_error("skill for locale `%s` not a json object: %d", locale_name(lang), json->type);
         return;
     }
-    for (child=json->child;child;child=child->next) {
+    for (child = json->child; child; child = child->next) {
         skill_t sk = findskill(child->string);
-        if (sk!=NOSKILL) {
-            if (child->type==cJSON_String) {
+        if (sk != NOSKILL) {
+            if (child->type == cJSON_String) {
                 init_skill(lang, sk, child->valuestring);
                 locale_setstring(lang, mkname("skill", skillnames[sk]), child->valuestring);
             }
-            else if (child->type==cJSON_Array) {
+            else if (child->type == cJSON_Array) {
                 cJSON *entry;
-                for (entry=child->child;entry;entry=entry->next) {
+                for (entry = child->child; entry; entry = entry->next) {
                     init_skill(lang, sk, entry->valuestring);
-                    if (entry==child->child) {
-                        locale_setstring(lang, mkname("skill", skillnames[sk]), entry->valuestring); 
+                    if (entry == child->child) {
+                        locale_setstring(lang, mkname("skill", skillnames[sk]), entry->valuestring);
                     }
                 }
-            } else {
+            }
+            else {
                 log_error("invalid type %d for skill `%s`", child->type, child->string);
             }
-        } else {
+        }
+        else {
             log_error("unknown skill `%s` for locale `%s`", child->string, locale_name(lang));
         }
     }
@@ -573,29 +580,31 @@ static void json_skill(cJSON *json, struct locale *lang) {
 
 static void json_keyword(cJSON *json, struct locale *lang) {
     cJSON *child;
-    if (json->type!=cJSON_Object) {
+    if (json->type != cJSON_Object) {
         log_error("keywords for locale `%s` not a json object: %d", locale_name(lang), json->type);
         return;
     }
-    for (child=json->child;child;child=child->next) {
+    for (child = json->child; child; child = child->next) {
         keyword_t kwd = findkeyword(child->string);
-        if (kwd!=NOKEYWORD) {
-            if (child->type==cJSON_String) {
+        if (kwd != NOKEYWORD) {
+            if (child->type == cJSON_String) {
                 init_keyword(lang, kwd, child->valuestring);
                 locale_setstring(lang, mkname("keyword", keywords[kwd]), child->valuestring);
             }
-            else if (child->type==cJSON_Array) {
+            else if (child->type == cJSON_Array) {
                 cJSON *entry;
-                for (entry=child->child;entry;entry=entry->next) {
+                for (entry = child->child; entry; entry = entry->next) {
                     init_keyword(lang, kwd, entry->valuestring);
-                    if (entry==child->child) {
-                        locale_setstring(lang, mkname("keyword", keywords[kwd]), entry->valuestring); 
+                    if (entry == child->child) {
+                        locale_setstring(lang, mkname("keyword", keywords[kwd]), entry->valuestring);
                     }
                 }
-            } else {
+            }
+            else {
                 log_error("invalid type %d for keyword `%s`", child->type, child->string);
             }
-        } else {
+        }
+        else {
             log_error("unknown keyword `%s` for locale `%s`", child->string, locale_name(lang));
         }
     }
@@ -603,11 +612,11 @@ static void json_keyword(cJSON *json, struct locale *lang) {
 
 static void json_skills(cJSON *json) {
     cJSON *child;
-    if (json->type!=cJSON_Object) {
+    if (json->type != cJSON_Object) {
         log_error("skills is not a json object: %d", json->type);
         return;
     }
-    for (child=json->child;child;child=child->next) {
+    for (child = json->child; child; child = child->next) {
         struct locale * lang = get_or_create_locale(child->string);
         json_skill(child, lang);
     }
@@ -615,11 +624,11 @@ static void json_skills(cJSON *json) {
 
 static void json_keywords(cJSON *json) {
     cJSON *child;
-    if (json->type!=cJSON_Object) {
+    if (json->type != cJSON_Object) {
         log_error("keywords is not a json object: %d", json->type);
         return;
     }
-    for (child=json->child;child;child=child->next) {
+    for (child = json->child; child; child = child->next) {
         struct locale * lang = get_or_create_locale(child->string);
         json_keyword(child, lang);
     }
@@ -674,13 +683,13 @@ static void json_include(cJSON *json) {
 
 void json_config(cJSON *json) {
     cJSON *child;
-    if (json->type!=cJSON_Object) {
+    if (json->type != cJSON_Object) {
         log_error("config is not a json object: %d", json->type);
         return;
     }
     reset_locales();
-    for (child=json->child;child;child=child->next) {
-        if (strcmp(child->string, "races")==0) {
+    for (child = json->child; child; child = child->next) {
+        if (strcmp(child->string, "races") == 0) {
             json_races(child);
         }
         else if (strcmp(child->string, "items") == 0) {
@@ -692,16 +701,16 @@ void json_config(cJSON *json) {
         else if (strcmp(child->string, "ships") == 0) {
             json_ships(child);
         }
-        else if (strcmp(child->string, "strings")==0) {
+        else if (strcmp(child->string, "strings") == 0) {
             json_strings(child);
         }
-        else if (strcmp(child->string, "directions")==0) {
+        else if (strcmp(child->string, "directions") == 0) {
             json_directions(child);
         }
-        else if (strcmp(child->string, "keywords")==0) {
+        else if (strcmp(child->string, "keywords") == 0) {
             json_keywords(child);
         }
-        else if (strcmp(child->string, "skills")==0) {
+        else if (strcmp(child->string, "skills") == 0) {
             json_skills(child);
         }
         else if (strcmp(child->string, "buildings") == 0) {
@@ -712,7 +721,8 @@ void json_config(cJSON *json) {
         }
         else if (strcmp(child->string, "terrains") == 0) {
             json_terrains(child);
-        } else {
+        }
+        else {
             log_error("config contains unknown attribute %s", child->string);
         }
     }
diff --git a/src/kernel/jsonconf.h b/src/kernel/jsonconf.h
index 6940386e9..d7c66ecb1 100644
--- a/src/kernel/jsonconf.h
+++ b/src/kernel/jsonconf.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/*
 +-------------------+
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Christian Schlittchen <corwin@amber.kn-bremen.de>
@@ -17,9 +17,11 @@ extern "C" {
 #endif
 
     struct cJSON;
-    void json_config(struct cJSON *str);
+
     extern const char * json_relpath;
 
+    void json_config(struct cJSON *str);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/kernel/jsonconf.test.c b/src/kernel/jsonconf.test.c
index 4c8c8a0fc..3bba66a88 100644
--- a/src/kernel/jsonconf.test.c
+++ b/src/kernel/jsonconf.test.c
@@ -85,7 +85,7 @@ static void test_races(CuTest * tc)
     CuAssertPtrNotNull(tc, races);
     rc = rc_find("orc");
     CuAssertPtrNotNull(tc, rc);
-    CuAssertIntEquals(tc, RCF_NPC|RCF_WALK|RCF_UNDEAD, rc->flags);
+    CuAssertIntEquals(tc, RCF_NPC | RCF_WALK | RCF_UNDEAD, rc->flags);
     CuAssertStrEquals(tc, "1d4", rc->def_damage);
     CuAssertDblEquals(tc, 1.0, rc->magres, 0.0);
     CuAssertDblEquals(tc, 2.0, rc->maxaura, 0.0);
@@ -145,7 +145,7 @@ static void test_items(CuTest * tc)
     itype = it_find("horse");
     CuAssertPtrNotNull(tc, itype);
     CuAssertIntEquals(tc, 20, itype->capacity);
-    CuAssertIntEquals(tc, ITF_ANIMAL|ITF_BIG, itype->flags);
+    CuAssertIntEquals(tc, ITF_ANIMAL | ITF_BIG, itype->flags);
 
     CuAssertPtrNotNull(tc, rt_find("axe"));
     CuAssertPtrNotNull(tc, (void *)get_resourcetype(R_HORSE));
@@ -279,7 +279,7 @@ static void test_buildings(CuTest * tc)
     CuAssertPtrNotNull(tc, bt->maintenance);
     CuAssertIntEquals(tc, 1, bt->maintenance[0].number);
     CuAssertPtrEquals(tc, (void *)get_resourcetype(R_IRON), (void *)bt->maintenance[0].rtype);
-    CuAssertIntEquals(tc, MTF_VARIABLE|MTF_VITAL, bt->maintenance[0].flags);
+    CuAssertIntEquals(tc, MTF_VARIABLE | MTF_VITAL, bt->maintenance[0].flags);
     CuAssertIntEquals(tc, 0, bt->maintenance[1].number);
 
     CuAssertPtrNotNull(tc, bt->construction);
@@ -329,7 +329,7 @@ static void test_terrains(CuTest * tc)
     json_config(json);
     ter = get_terrain("plain");
     CuAssertPtrNotNull(tc, ter);
-    CuAssertIntEquals(tc, ter->flags, LAND_REGION|FLY_INTO|WALK_INTO);
+    CuAssertIntEquals(tc, ter->flags, LAND_REGION | FLY_INTO | WALK_INTO);
 
     test_cleanup();
 }
diff --git a/src/kernel/messages.c b/src/kernel/messages.c
index 46329d66b..8ec8daa87 100644
--- a/src/kernel/messages.c
+++ b/src/kernel/messages.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -46,9 +46,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include <assert.h>
 
 typedef struct msg_setting {
-  struct msg_setting *next;
-  const struct message_type *type;
-  int level;
+    struct msg_setting *next;
+    const struct message_type *type;
+    int level;
 } msg_setting;
 
 /************ Compatibility function *************/
@@ -58,196 +58,204 @@ typedef struct msg_setting {
 
 static void
 arg_set(variant args[], const message_type * mtype, const char *buffer,
-  variant v)
+variant v)
 {
-  int i;
-  for (i = 0; i != mtype->nparameters; ++i) {
-    if (!strcmp(buffer, mtype->pnames[i]))
-      break;
-  }
-  if (i != mtype->nparameters) {
-    args[i] = v;
-  } else {
-    log_error("invalid parameter %s for message type %s\n", buffer,
-      mtype->name);
-    assert(!"program aborted.");
-  }
+    int i;
+    for (i = 0; i != mtype->nparameters; ++i) {
+        if (!strcmp(buffer, mtype->pnames[i]))
+            break;
+    }
+    if (i != mtype->nparameters) {
+        args[i] = v;
+    }
+    else {
+        log_error("invalid parameter %s for message type %s\n", buffer,
+            mtype->name);
+        assert(!"program aborted.");
+    }
 }
 
 struct message *msg_feedback(const struct unit *u, struct order *ord,
-  const char *name, const char *sig, ...)
+    const char *name, const char *sig, ...)
 {
-  va_list marker;
-  const message_type *mtype = mt_find(name);
-  char paramname[64];
-  const char *ic = sig;
-  variant args[16];
-  variant var;
-  memset(args, 0, sizeof(args));
+    va_list marker;
+    const message_type *mtype = mt_find(name);
+    char paramname[64];
+    const char *ic = sig;
+    variant args[16];
+    variant var;
+    memset(args, 0, sizeof(args));
 
-  if (ord == NULL)
-    ord = u->thisorder;
+    if (ord == NULL)
+        ord = u->thisorder;
 
-  if (!mtype) {
-    log_error("trying to create message of unknown type \"%s\"\n", name);
-    return msg_message("missing_feedback", "unit region command name", u,
-      u->region, ord, name);
-  }
-
-  var.v = (void *)u;
-  arg_set(args, mtype, "unit", var);
-  var.v = (void *)u->region;
-  arg_set(args, mtype, "region", var);
-  var.v = (void *)ord;
-  arg_set(args, mtype, "command", var);
-
-  va_start(marker, sig);
-  while (*ic && !isalnum(*ic))
-    ic++;
-  while (*ic) {
-    char *oc = paramname;
-    int i;
-
-    while (isalnum(*ic))
-      *oc++ = *ic++;
-    *oc = '\0';
-
-    for (i = 0; i != mtype->nparameters; ++i) {
-      if (!strcmp(paramname, mtype->pnames[i]))
-        break;
-    }
-    if (i != mtype->nparameters) {
-      if (mtype->types[i]->vtype == VAR_VOIDPTR) {
-        args[i].v = va_arg(marker, void *);
-      } else if (mtype->types[i]->vtype == VAR_INT) {
-        args[i].i = va_arg(marker, int);
-      } else {
-        assert(!"unknown variant type");
-      }
-    } else {
-      log_error("invalid parameter %s for message type %s\n", paramname, mtype->name);
-      assert(!"program aborted.");
+    if (!mtype) {
+        log_error("trying to create message of unknown type \"%s\"\n", name);
+        return msg_message("missing_feedback", "unit region command name", u,
+            u->region, ord, name);
     }
+
+    var.v = (void *)u;
+    arg_set(args, mtype, "unit", var);
+    var.v = (void *)u->region;
+    arg_set(args, mtype, "region", var);
+    var.v = (void *)ord;
+    arg_set(args, mtype, "command", var);
+
+    va_start(marker, sig);
     while (*ic && !isalnum(*ic))
-      ic++;
-  }
-  va_end(marker);
+        ic++;
+    while (*ic) {
+        char *oc = paramname;
+        int i;
 
-  return msg_create(mtype, args);
+        while (isalnum(*ic))
+            *oc++ = *ic++;
+        *oc = '\0';
+
+        for (i = 0; i != mtype->nparameters; ++i) {
+            if (!strcmp(paramname, mtype->pnames[i]))
+                break;
+        }
+        if (i != mtype->nparameters) {
+            if (mtype->types[i]->vtype == VAR_VOIDPTR) {
+                args[i].v = va_arg(marker, void *);
+            }
+            else if (mtype->types[i]->vtype == VAR_INT) {
+                args[i].i = va_arg(marker, int);
+            }
+            else {
+                assert(!"unknown variant type");
+            }
+        }
+        else {
+            log_error("invalid parameter %s for message type %s\n", paramname, mtype->name);
+            assert(!"program aborted.");
+        }
+        while (*ic && !isalnum(*ic))
+            ic++;
+    }
+    va_end(marker);
+
+    return msg_create(mtype, args);
 }
 
 message *msg_message(const char *name, const char *sig, ...)
-        /* msg_message("oops_error", "unit region command", u, r, cmd) */
+/* msg_message("oops_error", "unit region command", u, r, cmd) */
 {
-  va_list vargs;
-  const message_type *mtype = mt_find(name);
-  char paramname[64];
-  const char *ic = sig;
-  variant args[16];
-  memset(args, 0, sizeof(args));
+    va_list vargs;
+    const message_type *mtype = mt_find(name);
+    char paramname[64];
+    const char *ic = sig;
+    variant args[16];
+    memset(args, 0, sizeof(args));
 
-  if (!mtype) {
-    log_warning("trying to create message of unknown type \"%s\"\n", name);
-    if (strcmp(name, "missing_message") != 0) {
-      return msg_message("missing_message", "name", name);
+    if (!mtype) {
+        log_warning("trying to create message of unknown type \"%s\"\n", name);
+        if (strcmp(name, "missing_message") != 0) {
+            return msg_message("missing_message", "name", name);
+        }
+        return NULL;
     }
-    return NULL;
-  }
 
-  va_start(vargs, sig);
-  while (*ic && !isalnum(*ic))
-    ic++;
-  while (*ic) {
-    char *oc = paramname;
-    int i;
-
-    while (isalnum(*ic))
-      *oc++ = *ic++;
-    *oc = '\0';
-
-    for (i = 0; i != mtype->nparameters; ++i) {
-      if (!strcmp(paramname, mtype->pnames[i]))
-        break;
-    }
-    if (i != mtype->nparameters) {
-      if (mtype->types[i]->vtype == VAR_VOIDPTR) {
-          args[i].v = va_arg(vargs, void *);
-      } else if (mtype->types[i]->vtype == VAR_INT) {
-          args[i].i = va_arg(vargs, int);
-      } else {
-        assert(!"unknown variant type");
-      }
-    } else {
-      log_error("invalid parameter %s for message type %s\n", paramname, mtype->name);
-      assert(!"program aborted.");
-    }
+    va_start(vargs, sig);
     while (*ic && !isalnum(*ic))
-      ic++;
-  }
-  va_end(vargs);
+        ic++;
+    while (*ic) {
+        char *oc = paramname;
+        int i;
 
-  return msg_create(mtype, args);
+        while (isalnum(*ic))
+            *oc++ = *ic++;
+        *oc = '\0';
+
+        for (i = 0; i != mtype->nparameters; ++i) {
+            if (!strcmp(paramname, mtype->pnames[i]))
+                break;
+        }
+        if (i != mtype->nparameters) {
+            if (mtype->types[i]->vtype == VAR_VOIDPTR) {
+                args[i].v = va_arg(vargs, void *);
+            }
+            else if (mtype->types[i]->vtype == VAR_INT) {
+                args[i].i = va_arg(vargs, int);
+            }
+            else {
+                assert(!"unknown variant type");
+            }
+        }
+        else {
+            log_error("invalid parameter %s for message type %s\n", paramname, mtype->name);
+            assert(!"program aborted.");
+        }
+        while (*ic && !isalnum(*ic))
+            ic++;
+    }
+    va_end(vargs);
+
+    return msg_create(mtype, args);
 }
 
 static void
 caddmessage(region * r, faction * f, const char *s, msg_t mtype, int level)
 {
-  message *m = NULL;
+    message *m = NULL;
 
 #define LOG_ENGLISH
 #ifdef LOG_ENGLISH
-  if (f && f->locale != default_locale) {
-    log_warning("message for locale \"%s\": %s\n", locale_name(f->locale), s);
-  }
+    if (f && f->locale != default_locale) {
+        log_warning("message for locale \"%s\": %s\n", locale_name(f->locale), s);
+    }
 #endif
-  unused_arg(level);
-  switch (mtype) {
+    unused_arg(level);
+    switch (mtype) {
     case MSG_INCOME:
-      assert(f);
-      m = add_message(&f->msgs, msg_message("msg_economy", "string", s));
-      break;
+        assert(f);
+        m = add_message(&f->msgs, msg_message("msg_economy", "string", s));
+        break;
     case MSG_BATTLE:
-      assert(0 || !"battle messages must not use addmessage");
-      break;
+        assert(0 || !"battle messages must not use addmessage");
+        break;
     case MSG_MOVE:
-      assert(f);
-      m = add_message(&f->msgs, msg_message("msg_movement", "string", s));
-      break;
+        assert(f);
+        m = add_message(&f->msgs, msg_message("msg_movement", "string", s));
+        break;
     case MSG_COMMERCE:
-      assert(f);
-      m = add_message(&f->msgs, msg_message("msg_economy", "string", s));
-      break;
+        assert(f);
+        m = add_message(&f->msgs, msg_message("msg_economy", "string", s));
+        break;
     case MSG_PRODUCE:
-      assert(f);
-      m = add_message(&f->msgs, msg_message("msg_production", "string", s));
-      break;
+        assert(f);
+        m = add_message(&f->msgs, msg_message("msg_production", "string", s));
+        break;
     case MSG_MAGIC:
     case MSG_COMMENT:
     case MSG_MESSAGE:
     case MSG_ORCVERMEHRUNG:
     case MSG_EVENT:
-      /* Botschaften an REGION oder einzelne PARTEI */
-      m = msg_message("msg_event", "string", s);
-      if (!r) {
-        assert(f);
-        m = add_message(&f->msgs, m);
-      } else {
-        if (f == NULL)
-          add_message(&r->msgs, m);
-        else
-          r_addmessage(r, f, m);
-      }
-      break;
+        /* Botschaften an REGION oder einzelne PARTEI */
+        m = msg_message("msg_event", "string", s);
+        if (!r) {
+            assert(f);
+            m = add_message(&f->msgs, m);
+        }
+        else {
+            if (f == NULL)
+                add_message(&r->msgs, m);
+            else
+                r_addmessage(r, f, m);
+        }
+        break;
     default:
-      assert(!"invalid message class");
-  }
-  if (m)
-    msg_release(m);
+        assert(!"invalid message class");
+    }
+    if (m)
+        msg_release(m);
 }
 
 void addmessage(region * r, faction * f, const char *s, msg_t mtype, int level)
 {
-  caddmessage(r, f, s, mtype, level);
+    caddmessage(r, f, s, mtype, level);
 }
 
 message * msg_error(const unit * u, struct order *ord, int mno) {
@@ -272,28 +280,28 @@ extern unsigned int new_hashstring(const char *s);
 
 void free_messagelist(message_list * msgs)
 {
-  struct mlist **mlistptr = &msgs->begin;
-  while (*mlistptr) {
-    struct mlist *ml = *mlistptr;
-    *mlistptr = ml->next;
-    msg_release(ml->msg);
-    free(ml);
-  }
-  free(msgs);
+    struct mlist **mlistptr = &msgs->begin;
+    while (*mlistptr) {
+        struct mlist *ml = *mlistptr;
+        *mlistptr = ml->next;
+        msg_release(ml->msg);
+        free(ml);
+    }
+    free(msgs);
 }
 
 message *add_message(message_list ** pm, message * m)
 {
-  if (!lomem && m != NULL) {
-    struct mlist *mnew = malloc(sizeof(struct mlist));
-    if (*pm == NULL) {
-      *pm = malloc(sizeof(message_list));
-      (*pm)->end = &(*pm)->begin;
+    if (!lomem && m != NULL) {
+        struct mlist *mnew = malloc(sizeof(struct mlist));
+        if (*pm == NULL) {
+            *pm = malloc(sizeof(message_list));
+            (*pm)->end = &(*pm)->begin;
+        }
+        mnew->msg = msg_addref(m);
+        mnew->next = NULL;
+        *((*pm)->end) = mnew;
+        (*pm)->end = &mnew->next;
     }
-    mnew->msg = msg_addref(m);
-    mnew->next = NULL;
-    *((*pm)->end) = mnew;
-    (*pm)->end = &mnew->next;
-  }
-  return m;
+    return m;
 }
diff --git a/src/kernel/messages.h b/src/kernel/messages.h
index b9c07b0c9..f591e8ccd 100644
--- a/src/kernel/messages.h
+++ b/src/kernel/messages.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -28,36 +28,36 @@ extern "C" {
     struct faction;
     struct msglevel;
 
-  typedef struct mlist {
-    struct mlist *next;
-    struct message *msg;
-  } mlist;
+    typedef struct mlist {
+        struct mlist *next;
+        struct message *msg;
+    } mlist;
 
-  typedef struct message_list {
-    struct mlist *begin, **end;
-  } message_list;
+    typedef struct message_list {
+        struct mlist *begin, **end;
+    } message_list;
 
-  extern void free_messagelist(message_list * msgs);
+    extern void free_messagelist(message_list * msgs);
 
-  typedef struct msglevel {
-    /* used to set specialized msg-levels */
-    struct msglevel *next;
-    const struct message_type *type;
-    int level;
-  } msglevel;
+    typedef struct msglevel {
+        /* used to set specialized msg-levels */
+        struct msglevel *next;
+        const struct message_type *type;
+        int level;
+    } msglevel;
 
-  extern struct message *msg_message(const char *name, const char *sig, ...);
-  extern struct message *msg_feedback(const struct unit *, struct order *cmd,
-    const char *name, const char *sig, ...);
-  extern struct message *add_message(struct message_list **pm,
+    extern struct message *msg_message(const char *name, const char *sig, ...);
+    extern struct message *msg_feedback(const struct unit *, struct order *cmd,
+        const char *name, const char *sig, ...);
+    extern struct message *add_message(struct message_list **pm,
     struct message *m);
-  void addmessage(struct region *r, struct faction *f, const char *s,
-    msg_t mtype, int level);
+    void addmessage(struct region *r, struct faction *f, const char *s,
+        msg_t mtype, int level);
 
 #define ADDMSG(msgs, mcreate) { message * m = mcreate; if (m) { assert(m->refcount>=1); add_message(msgs, m); msg_release(m); } }
 
-  struct message * cmistake(const struct unit *u, struct order *ord, int mno, int mtype);
-  struct message * msg_error(const struct unit * u, struct order *ord, int mno);
+    struct message * cmistake(const struct unit *u, struct order *ord, int mno, int mtype);
+    struct message * msg_error(const struct unit * u, struct order *ord, int mno);
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/kernel/messages.test.c b/src/kernel/messages.test.c
index e237ab8de..9d0642df1 100644
--- a/src/kernel/messages.test.c
+++ b/src/kernel/messages.test.c
@@ -15,8 +15,8 @@ void test_missing_message(CuTest *tc) {
 
 void test_message(CuTest *tc) {
     message *msg;
-//    const char * args[] = { }
     message_type *mtype = mt_new("custom", NULL);
+
     mt_register(mtype);
     CuAssertPtrEquals(tc, mtype, (void *)mt_find("custom"));
     CuAssertIntEquals(tc, 0, mtype->nparameters);
diff --git a/src/kernel/objtypes.h b/src/kernel/objtypes.h
index 293158ecb..7e7e97bb1 100644
--- a/src/kernel/objtypes.h
+++ b/src/kernel/objtypes.h
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
                          Katja Zedel <katze@felidae.kn-bremen.de
                          Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/kernel/order.c b/src/kernel/order.c
index ed0c1642b..70114125d 100644
--- a/src/kernel/order.c
+++ b/src/kernel/order.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/*
  +-------------------+
  |                   |  Christian Schlittchen <corwin@amber.kn-bremen.de>
  | Eressea PBEM host |  Enno Rehling <enno@eressea.de>
@@ -183,7 +183,7 @@ static char *mkdata(order_data **pdata, size_t len, keyword_t kwd, int lindex, c
 {
     order_data *data;
     char *result;
-    data = malloc(sizeof(order_data) + len +1);
+    data = malloc(sizeof(order_data) + len + 1);
     result = (char *)(data + 1);
     data->_keyword = kwd;
     data->_lindex = lindex;
@@ -255,7 +255,7 @@ static order *create_order_i(keyword_t kwd, const char *sptr, int persistent,
     order *ord = NULL;
     int lindex;
 
-    if ((int)kwd>0 && keyword_disabled(kwd)) {
+    if ((int)kwd > 0 && keyword_disabled(kwd)) {
         log_error("trying to create an order for disabled keyword %s.", keyword(kwd));
         return NULL;
     }
diff --git a/src/kernel/order.h b/src/kernel/order.h
index 0f95b6465..22e401438 100644
--- a/src/kernel/order.h
+++ b/src/kernel/order.h
@@ -1,14 +1,14 @@
-/* vi: set ts=2:
- +-------------------+  
+/*
+ +-------------------+
  |                   |  Christian Schlittchen <corwin@amber.kn-bremen.de>
  | Eressea PBEM host |  Enno Rehling <enno@eressea.de>
  | (c) 1998 - 2004   |  Katja Zedel <katze@felidae.kn-bremen.de>
  |                   |
- +-------------------+  
+ +-------------------+
 
  This program may not be used, modified or distributed
  without prior permission by the authors of Eressea.
-*/
+ */
 
 #ifndef KRNL_ORDER_H
 #define KRNL_ORDER_H
@@ -18,48 +18,48 @@ extern "C" {
 
 #include "keyword.h"
 
-/* Encapsulation of an order
- *
- * This structure contains one order given by a unit. These used to be
- * stored in string lists, but by storing them in order-structures,
- * it is possible to use reference-counting on them, reduce string copies,
- * and reduce overall memory usage by sharing strings between orders (not
- * implemented yet) saving approx. 50% of all string-related memory.
- */
+    /* Encapsulation of an order
+     *
+     * This structure contains one order given by a unit. These used to be
+     * stored in string lists, but by storing them in order-structures,
+     * it is possible to use reference-counting on them, reduce string copies,
+     * and reduce overall memory usage by sharing strings between orders (not
+     * implemented yet) saving approx. 50% of all string-related memory.
+     */
 
-  struct order_data;
+    struct order_data;
 
-  typedef struct order {
-    struct order *next;
-    /* do not access this data: */
-    struct order_data *data;
-    int _persistent:1;
-  } order;
+    typedef struct order {
+        struct order *next;
+        /* do not access this data: */
+        struct order_data *data;
+        int _persistent : 1;
+    } order;
 
-/* constructor */
-  extern order *create_order(keyword_t kwd, const struct locale *lang,
-    const char *params, ...);
-  extern order *parse_order(const char *s, const struct locale *lang);
-  extern void replace_order(order ** dst, order * orig, const order * src);
+    /* constructor */
+    extern order *create_order(keyword_t kwd, const struct locale *lang,
+        const char *params, ...);
+    extern order *parse_order(const char *s, const struct locale *lang);
+    extern void replace_order(order ** dst, order * orig, const order * src);
 
-/* reference counted copies of orders: */
-  extern order *copy_order(const order * ord);
-  extern void free_order(order * ord);
-  extern void free_orders(order ** olist);
+    /* reference counted copies of orders: */
+    extern order *copy_order(const order * ord);
+    extern void free_order(order * ord);
+    extern void free_orders(order ** olist);
 
-  extern void push_order(struct order **olist, struct order *ord);
+    extern void push_order(struct order **olist, struct order *ord);
 
-/* access functions for orders */
-  keyword_t getkeyword(const order * ord);
-  void set_order(order ** destp, order * src);
-  char* get_command(const order *ord, char *buffer, size_t size);
-  bool is_persistent(const order * ord);
-  bool is_exclusive(const order * ord);
-  bool is_repeated(const order * ord);
-  bool is_long(const order * ord);
+    /* access functions for orders */
+    keyword_t getkeyword(const order * ord);
+    void set_order(order ** destp, order * src);
+    char* get_command(const order *ord, char *buffer, size_t size);
+    bool is_persistent(const order * ord);
+    bool is_exclusive(const order * ord);
+    bool is_repeated(const order * ord);
+    bool is_long(const order * ord);
 
-  char *write_order(const order * ord, char *buffer, size_t size);
-  keyword_t init_order(const struct order *ord);
+    char *write_order(const order * ord, char *buffer, size_t size);
+    keyword_t init_order(const struct order *ord);
 
 #ifdef __cplusplus
 }
diff --git a/src/kernel/order.test.c b/src/kernel/order.test.c
index 2ff7d8a4e..414dd87e7 100644
--- a/src/kernel/order.test.c
+++ b/src/kernel/order.test.c
@@ -34,7 +34,7 @@ static void test_parse_order(CuTest *tc) {
     char cmd[32];
     order *ord;
     struct locale * lang;
-    
+
     test_cleanup();
     lang = get_or_create_locale("en");
 
diff --git a/src/kernel/pathfinder.c b/src/kernel/pathfinder.c
index 875211deb..01c7ceccd 100644
--- a/src/kernel/pathfinder.c
+++ b/src/kernel/pathfinder.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -30,183 +30,185 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 bool allowed_swim(const region * src, const region * r)
 {
-  if (fval(r->terrain, SWIM_INTO))
-    return true;
-  return false;
+    if (fval(r->terrain, SWIM_INTO))
+        return true;
+    return false;
 }
 
 bool allowed_walk(const region * src, const region * r)
 {
-  if (fval(r->terrain, WALK_INTO))
-    return true;
-  return false;
+    if (fval(r->terrain, WALK_INTO))
+        return true;
+    return false;
 }
 
 bool allowed_fly(const region * src, const region * r)
 {
-  if (fval(r->terrain, FLY_INTO))
-    return true;
-  return false;
+    if (fval(r->terrain, FLY_INTO))
+        return true;
+    return false;
 }
 
 typedef struct node {
-  struct node *next;
-  region *r;
-  struct node *prev;
-  int distance;
+    struct node *next;
+    region *r;
+    struct node *prev;
+    int distance;
 } node;
 
 static node *node_garbage;
 
 void pathfinder_cleanup(void)
 {
-  while (node_garbage) {
-    node *n = node_garbage;
-    node_garbage = n->next;
-    free(n);
-  }
+    while (node_garbage) {
+        node *n = node_garbage;
+        node_garbage = n->next;
+        free(n);
+    }
 }
 
 static node *new_node(region * r, int distance, node * prev)
 {
-  node *n;
-  if (node_garbage != NULL) {
-    n = node_garbage;
-    node_garbage = n->next;
-  } else
-    n = malloc(sizeof(node));
-  n->next = NULL;
-  n->prev = prev;
-  n->r = r;
-  n->distance = distance;
-  return n;
+    node *n;
+    if (node_garbage != NULL) {
+        n = node_garbage;
+        node_garbage = n->next;
+    }
+    else
+        n = malloc(sizeof(node));
+    n->next = NULL;
+    n->prev = prev;
+    n->r = r;
+    n->distance = distance;
+    return n;
 }
 
 static node *free_node(node * n)
 {
-  node *s = n->next;
-  n->next = node_garbage;
-  node_garbage = n;
-  return s;
+    node *s = n->next;
+    n->next = node_garbage;
+    node_garbage = n;
+    return s;
 }
 
 static void free_nodes(node * root)
 {
-  while (root != NULL) {
-    region *r = root->r;
-    freset(r, RF_MARK);
-    root = free_node(root);
-  }
+    while (root != NULL) {
+        region *r = root->r;
+        freset(r, RF_MARK);
+        root = free_node(root);
+    }
 }
 
 struct quicklist *regions_in_range(struct region *start, int maxdist,
-  bool(*allowed) (const struct region *, const struct region *))
+    bool(*allowed) (const struct region *, const struct region *))
 {
-  quicklist * rlist = NULL;
-  node *root = new_node(start, 0, NULL);
-  node **end = &root->next;
-  node *n = root;
+    quicklist * rlist = NULL;
+    node *root = new_node(start, 0, NULL);
+    node **end = &root->next;
+    node *n = root;
 
-  while (n != NULL) {
-    region *r = n->r;
-    int depth = n->distance + 1;
-    int d;
+    while (n != NULL) {
+        region *r = n->r;
+        int depth = n->distance + 1;
+        int d;
 
-    if (n->distance >= maxdist)
-      break;
-    for (d = 0; d != MAXDIRECTIONS; ++d) {
-      region *rn = rconnect(r, d);
-      if (rn == NULL)
-        continue;
-      if (fval(rn, RF_MARK))
-        continue;               /* already been there */
-      if (allowed && !allowed(r, rn))
-        continue;               /* can't go there */
+        if (n->distance >= maxdist)
+            break;
+        for (d = 0; d != MAXDIRECTIONS; ++d) {
+            region *rn = rconnect(r, d);
+            if (rn == NULL)
+                continue;
+            if (fval(rn, RF_MARK))
+                continue;               /* already been there */
+            if (allowed && !allowed(r, rn))
+                continue;               /* can't go there */
 
-      /* add the region to the list of available ones. */
-      ql_push(&rlist, rn);
+            /* add the region to the list of available ones. */
+            ql_push(&rlist, rn);
 
-      /* make sure we don't go here again, and put the region into the set for
-         further BFS'ing */
-      fset(rn, RF_MARK);
-      *end = new_node(rn, depth, n);
-      end = &(*end)->next;
+            /* make sure we don't go here again, and put the region into the set for
+               further BFS'ing */
+            fset(rn, RF_MARK);
+            *end = new_node(rn, depth, n);
+            end = &(*end)->next;
+        }
+        n = n->next;
     }
-    n = n->next;
-  }
-  free_nodes(root);
+    free_nodes(root);
 
-  return rlist;
+    return rlist;
 }
 
 static region **internal_path_find(region * start, const region * target,
-  int maxlen, bool(*allowed) (const region *, const region *))
+    int maxlen, bool(*allowed) (const region *, const region *))
 {
-  static region *path[MAXDEPTH + 2];    /* STATIC_RETURN: used for return, not across calls */
-  direction_t d;
-  node *root = new_node(start, 0, NULL);
-  node **end = &root->next;
-  node *n = root;
-  bool found = false;
-  assert(maxlen <= MAXDEPTH);
-  fset(start, RF_MARK);
+    static region *path[MAXDEPTH + 2];    /* STATIC_RETURN: used for return, not across calls */
+    direction_t d;
+    node *root = new_node(start, 0, NULL);
+    node **end = &root->next;
+    node *n = root;
+    bool found = false;
+    assert(maxlen <= MAXDEPTH);
+    fset(start, RF_MARK);
 
-  while (n != NULL) {
-    region *r = n->r;
-    int depth = n->distance + 1;
-    if (n->distance >= maxlen)
-      break;
-    for (d = 0; d != MAXDIRECTIONS; ++d) {
-      region *rn = rconnect(r, d);
-      if (rn == NULL)
-        continue;
-      if (fval(rn, RF_MARK))
-        continue;               /* already been there */
-      if (!allowed(r, rn))
-        continue;               /* can't go there */
-      if (rn == target) {
-        int i = depth;
-        path[i + 1] = NULL;
-        path[i] = rn;
-        while (n) {
-          path[--i] = n->r;
-          n = n->prev;
+    while (n != NULL) {
+        region *r = n->r;
+        int depth = n->distance + 1;
+        if (n->distance >= maxlen)
+            break;
+        for (d = 0; d != MAXDIRECTIONS; ++d) {
+            region *rn = rconnect(r, d);
+            if (rn == NULL)
+                continue;
+            if (fval(rn, RF_MARK))
+                continue;               /* already been there */
+            if (!allowed(r, rn))
+                continue;               /* can't go there */
+            if (rn == target) {
+                int i = depth;
+                path[i + 1] = NULL;
+                path[i] = rn;
+                while (n) {
+                    path[--i] = n->r;
+                    n = n->prev;
+                }
+                found = true;
+                break;
+            }
+            else {
+                fset(rn, RF_MARK);
+                *end = new_node(rn, depth, n);
+                end = &(*end)->next;
+            }
         }
-        found = true;
-        break;
-      } else {
-        fset(rn, RF_MARK);
-        *end = new_node(rn, depth, n);
-        end = &(*end)->next;
-      }
+        if (found)
+            break;
+        n = n->next;
     }
+    free_nodes(root);
     if (found)
-      break;
-    n = n->next;
-  }
-  free_nodes(root);
-  if (found)
-    return path;
-  return NULL;
+        return path;
+    return NULL;
 }
 
 bool
 path_exists(region * start, const region * target, int maxlen,
-  bool(*allowed) (const region *, const region *))
+bool(*allowed) (const region *, const region *))
 {
-  assert((!fval(start, RF_MARK) && !fval(target, RF_MARK))
-    || !"Some Algorithm did not clear its RF_MARKs!");
-  if (start == target)
-    return true;
-  if (internal_path_find(start, target, maxlen, allowed) != NULL)
-    return true;
-  return false;
+    assert((!fval(start, RF_MARK) && !fval(target, RF_MARK))
+        || !"Some Algorithm did not clear its RF_MARKs!");
+    if (start == target)
+        return true;
+    if (internal_path_find(start, target, maxlen, allowed) != NULL)
+        return true;
+    return false;
 }
 
 region **path_find(region * start, const region * target, int maxlen,
-  bool(*allowed) (const region *, const region *))
+    bool(*allowed) (const region *, const region *))
 {
-  assert((!fval(start, RF_MARK) && !fval(target, RF_MARK))
-    || !"Did you call path_init()?");
-  return internal_path_find(start, target, maxlen, allowed);
+    assert((!fval(start, RF_MARK) && !fval(target, RF_MARK))
+        || !"Did you call path_init()?");
+    return internal_path_find(start, target, maxlen, allowed);
 }
diff --git a/src/kernel/pathfinder.h b/src/kernel/pathfinder.h
index 6c9edb94e..ce1def69c 100644
--- a/src/kernel/pathfinder.h
+++ b/src/kernel/pathfinder.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -24,25 +24,25 @@ extern "C" {
 
 #define MAXDEPTH 1024
 
-  extern int search[MAXDEPTH][2];
-  extern int search_len;
+    extern int search[MAXDEPTH][2];
+    extern int search_len;
 
-  extern struct region **path_find(struct region *start,
-    const struct region *target, int maxlen,
-    bool(*allowed) (const struct region *, const struct region *));
-  extern bool path_exists(struct region *start, const struct region *target,
-    int maxlen, bool(*allowed) (const struct region *,
-      const struct region *));
-  extern bool allowed_swim(const struct region *src,
-    const struct region *target);
-  extern bool allowed_fly(const struct region *src,
-    const struct region *target);
-  extern bool allowed_walk(const struct region *src,
-    const struct region *target);
-  extern struct quicklist *regions_in_range(struct region *src, int maxdist,
-    bool(*allowed) (const struct region *, const struct region *));
+    extern struct region **path_find(struct region *start,
+        const struct region *target, int maxlen,
+        bool(*allowed) (const struct region *, const struct region *));
+    extern bool path_exists(struct region *start, const struct region *target,
+        int maxlen, bool(*allowed) (const struct region *,
+        const struct region *));
+    extern bool allowed_swim(const struct region *src,
+        const struct region *target);
+    extern bool allowed_fly(const struct region *src,
+        const struct region *target);
+    extern bool allowed_walk(const struct region *src,
+        const struct region *target);
+    extern struct quicklist *regions_in_range(struct region *src, int maxdist,
+        bool(*allowed) (const struct region *, const struct region *));
 
-  extern void pathfinder_cleanup(void);
+    extern void pathfinder_cleanup(void);
 
 #ifdef __cplusplus
 }
diff --git a/src/kernel/plane.c b/src/kernel/plane.c
index 595ccbf2e..a6e5ff59a 100644
--- a/src/kernel/plane.c
+++ b/src/kernel/plane.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -40,283 +40,283 @@ struct plane *planes;
 
 int plane_width(const plane * pl)
 {
-  if (pl) {
-    return pl->maxx - pl->minx + 1;
-  }
-  return 0;
+    if (pl) {
+        return pl->maxx - pl->minx + 1;
+    }
+    return 0;
 }
 
 int plane_height(const plane * pl)
 {
-  if (pl) {
-    return pl->maxy - pl->miny + 1;
-  }
-  return 0;
+    if (pl) {
+        return pl->maxy - pl->miny + 1;
+    }
+    return 0;
 }
 
 plane *get_homeplane(void)
 {
-  return getplanebyid(0);
+    return getplanebyid(0);
 }
 
 plane *getplane(const region * r)
 {
-  if (r) {
-    return r->_plane;
-  }
-  return get_homeplane();
+    if (r) {
+        return r->_plane;
+    }
+    return get_homeplane();
 }
 
 plane *getplanebyid(int id)
 {
-  plane *p;
+    plane *p;
 
-  for (p = planes; p; p = p->next) {
-    if (p->id == id) {
-      return p;
+    for (p = planes; p; p = p->next) {
+        if (p->id == id) {
+            return p;
+        }
     }
-  }
-  return NULL;
+    return NULL;
 }
 
 plane *getplanebyname(const char *name)
 {
-  plane *p;
+    plane *p;
 
-  for (p = planes; p; p = p->next)
-    if (p->name && !strcmp(p->name, name))
-      return p;
-  return NULL;
+    for (p = planes; p; p = p->next)
+        if (p->name && !strcmp(p->name, name))
+            return p;
+    return NULL;
 }
 
 plane *findplane(int x, int y)
 {
-  plane *pl;
+    plane *pl;
 
-  for (pl = planes; pl; pl = pl->next) {
-    if (x >= pl->minx && x <= pl->maxx && y >= pl->miny && y <= pl->maxy) {
-      return pl;
+    for (pl = planes; pl; pl = pl->next) {
+        if (x >= pl->minx && x <= pl->maxx && y >= pl->miny && y <= pl->maxy) {
+            return pl;
+        }
     }
-  }
-  return NULL;
+    return NULL;
 }
 
 int getplaneid(const region * r)
 {
-  if (r) {
-    plane *pl = getplane(r);
-    if (pl)
-      return pl->id;
+    if (r) {
+        plane *pl = getplane(r);
+        if (pl)
+            return pl->id;
 
-    for (pl = planes; pl; pl = pl->next) {
-      if (r->x >= pl->minx && r->x <= pl->maxx
-        && r->y >= pl->miny && r->y <= pl->maxy) {
-        return pl->id;
-      }
+        for (pl = planes; pl; pl = pl->next) {
+            if (r->x >= pl->minx && r->x <= pl->maxx
+                && r->y >= pl->miny && r->y <= pl->maxy) {
+                return pl->id;
+            }
+        }
     }
-  }
-  return 0;
+    return 0;
 }
 
 static int
 ursprung_x(const faction * f, const plane * pl, const region * rdefault)
 {
-  ursprung *ur;
-  int id = 0;
+    ursprung *ur;
+    int id = 0;
 
-  if (!f)
-    return 0;
+    if (!f)
+        return 0;
 
-  if (pl)
-    id = pl->id;
+    if (pl)
+        id = pl->id;
 
-  for (ur = f->ursprung; ur; ur = ur->next) {
-    if (ur->id == id)
-      return ur->x;
-  }
-  if (!rdefault)
-    return 0;
-  set_ursprung((faction *) f, id, rdefault->x - plane_center_x(pl),
-    rdefault->y - plane_center_y(pl));
-  return rdefault->x - plane_center_x(pl);
+    for (ur = f->ursprung; ur; ur = ur->next) {
+        if (ur->id == id)
+            return ur->x;
+    }
+    if (!rdefault)
+        return 0;
+    set_ursprung((faction *)f, id, rdefault->x - plane_center_x(pl),
+        rdefault->y - plane_center_y(pl));
+    return rdefault->x - plane_center_x(pl);
 }
 
 static int
 ursprung_y(const faction * f, const plane * pl, const region * rdefault)
 {
-  ursprung *ur;
-  int id = 0;
+    ursprung *ur;
+    int id = 0;
 
-  if (!f)
-    return 0;
+    if (!f)
+        return 0;
 
-  if (pl)
-    id = pl->id;
+    if (pl)
+        id = pl->id;
 
-  for (ur = f->ursprung; ur; ur = ur->next) {
-    if (ur->id == id)
-      return ur->y;
-  }
-  if (!rdefault)
-    return 0;
-  set_ursprung((faction *) f, id, rdefault->x - plane_center_x(pl),
-    rdefault->y - plane_center_y(pl));
-  return rdefault->y - plane_center_y(pl);
+    for (ur = f->ursprung; ur; ur = ur->next) {
+        if (ur->id == id)
+            return ur->y;
+    }
+    if (!rdefault)
+        return 0;
+    set_ursprung((faction *)f, id, rdefault->x - plane_center_x(pl),
+        rdefault->y - plane_center_y(pl));
+    return rdefault->y - plane_center_y(pl);
 }
 
 int plane_center_x(const plane * pl)
 {
-  if (pl == NULL)
-    return 0;
+    if (pl == NULL)
+        return 0;
 
-  return (pl->minx + pl->maxx) / 2;
+    return (pl->minx + pl->maxx) / 2;
 }
 
 int plane_center_y(const plane * pl)
 {
-  if (pl == NULL)
-    return 0;
+    if (pl == NULL)
+        return 0;
 
-  return (pl->miny + pl->maxy) / 2;
+    return (pl->miny + pl->maxy) / 2;
 }
 
 void
 adjust_coordinates(const faction * f, int *x, int *y, const plane * pl,
-  const region * r)
+const region * r)
 {
-  int nx = *x;
-  int ny = *y;
-  if (f) {
-    nx -= ursprung_x(f, pl, r);
-    ny -= ursprung_y(f, pl, r);
-  }
-  if (pl) {
-    int plx = plane_center_x(pl);
-    int ply = plane_center_y(pl);
-    int width = plane_width(pl);
-    int height = plane_height(pl);
-    int width_2 = width / 2;
-    int height_2 = height / 2;
+    int nx = *x;
+    int ny = *y;
+    if (f) {
+        nx -= ursprung_x(f, pl, r);
+        ny -= ursprung_y(f, pl, r);
+    }
+    if (pl) {
+        int plx = plane_center_x(pl);
+        int ply = plane_center_y(pl);
+        int width = plane_width(pl);
+        int height = plane_height(pl);
+        int width_2 = width / 2;
+        int height_2 = height / 2;
 
-    nx -= plx;
-    ny -= ply;
+        nx -= plx;
+        ny -= ply;
 
-    if (nx < 0)
-      nx = (width - (-nx) % width);
-    if (nx > width_2)
-      nx -= width;
-    if (ny < 0)
-      ny = (height - (-ny) % height);
-    if (ny > height_2)
-      ny -= height;
+        if (nx < 0)
+            nx = (width - (-nx) % width);
+        if (nx > width_2)
+            nx -= width;
+        if (ny < 0)
+            ny = (height - (-ny) % height);
+        if (ny > height_2)
+            ny -= height;
 
-    assert(nx <= pl->maxx - plx);
-    assert(nx >= pl->minx - plx);
-    assert(ny <= pl->maxy - ply);
-    assert(ny >= pl->miny - ply);
+        assert(nx <= pl->maxx - plx);
+        assert(nx >= pl->minx - plx);
+        assert(ny <= pl->maxy - ply);
+        assert(ny >= pl->miny - ply);
 
-  }
+    }
 
-  *x = nx;
-  *y = ny;
+    *x = nx;
+    *y = ny;
 }
 
 void set_ursprung(faction * f, int id, int x, int y)
 {
-  ursprung *ur;
-  assert(f != NULL);
-  for (ur = f->ursprung; ur; ur = ur->next) {
-    if (ur->id == id) {
-      ur->x = ur->x + x;
-      ur->y = ur->y + y;
-      return;
+    ursprung *ur;
+    assert(f != NULL);
+    for (ur = f->ursprung; ur; ur = ur->next) {
+        if (ur->id == id) {
+            ur->x = ur->x + x;
+            ur->y = ur->y + y;
+            return;
+        }
     }
-  }
 
-  ur = calloc(1, sizeof(ursprung));
-  ur->id = id;
-  ur->x = x;
-  ur->y = y;
+    ur = calloc(1, sizeof(ursprung));
+    ur->id = id;
+    ur->x = x;
+    ur->y = y;
 
-  addlist(&f->ursprung, ur);
+    addlist(&f->ursprung, ur);
 }
 
 plane *create_new_plane(int id, const char *name, int minx, int maxx, int miny,
-  int maxy, int flags)
+    int maxy, int flags)
 {
-  plane *pl = getplanebyid(id);
+    plane *pl = getplanebyid(id);
 
-  if (pl)
+    if (pl)
+        return pl;
+    pl = calloc(1, sizeof(plane));
+
+    pl->next = NULL;
+    pl->id = id;
+    if (name)
+        pl->name = _strdup(name);
+    pl->minx = minx;
+    pl->maxx = maxx;
+    pl->miny = miny;
+    pl->maxy = maxy;
+    pl->flags = flags;
+
+    addlist(&planes, pl);
     return pl;
-  pl = calloc(1, sizeof(plane));
-
-  pl->next = NULL;
-  pl->id = id;
-  if (name)
-    pl->name = _strdup(name);
-  pl->minx = minx;
-  pl->maxx = maxx;
-  pl->miny = miny;
-  pl->maxy = maxy;
-  pl->flags = flags;
-
-  addlist(&planes, pl);
-  return pl;
 }
 
 /* Umrechnung Relative-Absolute-Koordinaten */
 int
 rel_to_abs(const struct plane *pl, const struct faction *f, int rel,
-  unsigned char index)
+unsigned char index)
 {
-  assert(index == 0 || index == 1);
+    assert(index == 0 || index == 1);
 
-  if (index == 0)
-    return (rel + ursprung_x(f, pl, NULL) + plane_center_x(pl));
+    if (index == 0)
+        return (rel + ursprung_x(f, pl, NULL) + plane_center_x(pl));
 
-  return (rel + ursprung_y(f, pl, NULL) + plane_center_y(pl));
+    return (rel + ursprung_y(f, pl, NULL) + plane_center_y(pl));
 }
 
 static int resolve_plane(variant id, void *addr)
 {
-  int result = 0;
-  plane *pl = NULL;
-  if (id.i != 0) {
-    pl = getplanebyid(id.i);
-    if (pl == NULL) {
-      result = -1;
+    int result = 0;
+    plane *pl = NULL;
+    if (id.i != 0) {
+        pl = getplanebyid(id.i);
+        if (pl == NULL) {
+            result = -1;
+        }
     }
-  }
-  *(plane **) addr = pl;
-  return result;
+    *(plane **)addr = pl;
+    return result;
 }
 
 void write_plane_reference(const plane * u, struct storage *store)
 {
-  WRITE_INT(store, u ? (u->id) : 0);
+    WRITE_INT(store, u ? (u->id) : 0);
 }
 
 int read_plane_reference(plane ** pp, struct storage *store)
 {
-  variant id;
-  READ_INT(store, &id.i);
-  if (id.i == 0) {
-    *pp = NULL;
-    return AT_READ_FAIL;
-  }
-  *pp = getplanebyid(id.i);
-  if (*pp == NULL)
-    ur_add(id, pp, resolve_plane);
-  return AT_READ_OK;
+    variant id;
+    READ_INT(store, &id.i);
+    if (id.i == 0) {
+        *pp = NULL;
+        return AT_READ_FAIL;
+    }
+    *pp = getplanebyid(id.i);
+    if (*pp == NULL)
+        ur_add(id, pp, resolve_plane);
+    return AT_READ_OK;
 }
 
 bool is_watcher(const struct plane * p, const struct faction * f)
 {
-  struct watcher *w;
-  if (!p)
-    return false;
-  w = p->watchers;
-  while (w && w->faction != f)
-    w = w->next;
-  return (w != NULL);
+    struct watcher *w;
+    if (!p)
+        return false;
+    w = p->watchers;
+    while (w && w->faction != f)
+        w = w->next;
+    return (w != NULL);
 }
diff --git a/src/kernel/plane.h b/src/kernel/plane.h
index e28e67266..afd705259 100644
--- a/src/kernel/plane.h
+++ b/src/kernel/plane.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -43,47 +43,47 @@ extern "C" {
 #define PFL_NOMONSTERS  16384   /* no monster randenc */
 #define PFL_SEESPECIAL  32768   /* far seeing */
 
-  typedef struct watcher {
-    struct watcher *next;
-    struct faction *faction;
-    unsigned char mode;
-  } watcher;
+    typedef struct watcher {
+        struct watcher *next;
+        struct faction *faction;
+        unsigned char mode;
+    } watcher;
 
-  typedef struct plane {
-    struct plane *next;
-    struct watcher *watchers;
-    int id;
-    char *name;
-    int minx, maxx, miny, maxy;
-    int flags;
-    struct attrib *attribs;
-  } plane;
+    typedef struct plane {
+        struct plane *next;
+        struct watcher *watchers;
+        int id;
+        char *name;
+        int minx, maxx, miny, maxy;
+        int flags;
+        struct attrib *attribs;
+    } plane;
 
 #define plane_id(pl) ( (pl) ? (pl)->id : 0 )
 
-  extern struct plane *planes;
+    extern struct plane *planes;
 
-  struct plane *getplane(const struct region *r);
-  struct plane *findplane(int x, int y);
-  void init_planes(void);
-  int getplaneid(const struct region *r);
-  struct plane *getplanebyid(int id);
-  int plane_center_x(const struct plane *pl);
-  int plane_center_y(const struct plane *pl);
-  void set_ursprung(struct faction *f, int id, int x, int y);
-  struct plane *create_new_plane(int id, const char *name, int minx, int maxx,
-    int miny, int maxy, int flags);
-  struct plane *getplanebyname(const char *);
-  struct plane *get_homeplane(void);
-  extern int rel_to_abs(const struct plane *pl, const struct faction *f,
-    int rel, unsigned char index);
-  extern bool is_watcher(const struct plane *p, const struct faction *f);
-  extern void write_plane_reference(const plane * p, struct storage *store);
-  extern int read_plane_reference(plane ** pp, struct storage *store);
-  extern int plane_width(const plane * pl);
-  extern int plane_height(const plane * pl);
-  void adjust_coordinates(const struct faction *f, int *x, int *y,
-    const struct plane *pl, const struct region *r);
+    struct plane *getplane(const struct region *r);
+    struct plane *findplane(int x, int y);
+    void init_planes(void);
+    int getplaneid(const struct region *r);
+    struct plane *getplanebyid(int id);
+    int plane_center_x(const struct plane *pl);
+    int plane_center_y(const struct plane *pl);
+    void set_ursprung(struct faction *f, int id, int x, int y);
+    struct plane *create_new_plane(int id, const char *name, int minx, int maxx,
+        int miny, int maxy, int flags);
+    struct plane *getplanebyname(const char *);
+    struct plane *get_homeplane(void);
+    extern int rel_to_abs(const struct plane *pl, const struct faction *f,
+        int rel, unsigned char index);
+    extern bool is_watcher(const struct plane *p, const struct faction *f);
+    extern void write_plane_reference(const plane * p, struct storage *store);
+    extern int read_plane_reference(plane ** pp, struct storage *store);
+    extern int plane_width(const plane * pl);
+    extern int plane_height(const plane * pl);
+    void adjust_coordinates(const struct faction *f, int *x, int *y,
+        const struct plane *pl, const struct region *r);
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/kernel/pool.c b/src/kernel/pool.c
index bad3d1d80..e2b0f1807 100644
--- a/src/kernel/pool.c
+++ b/src/kernel/pool.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
@@ -177,19 +177,19 @@ int count)
     if (rtype->flags & RTF_POOLED && mode & ~(GET_SLACK | GET_RESERVE)) {
         for (v = r->units; v && use < count; v = v->next)
             if (u != v && (v->items || rtype->uget)) {
-            int mask;
+                int mask;
 
-            if ((urace(v)->ec_flags & GIVEITEM) == 0)
-                continue;
+                if ((urace(v)->ec_flags & GIVEITEM) == 0)
+                    continue;
 
-            if (v->faction == f) {
-                mask = (mode >> 3) & (GET_SLACK | GET_RESERVE);
-            }
-            else if (alliedunit(v, f, HELP_MONEY))
-                mask = (mode >> 6) & (GET_SLACK | GET_RESERVE);
-            else
-                continue;
-            use += get_pooled(v, rtype, mask, count - use);
+                if (v->faction == f) {
+                    mask = (mode >> 3) & (GET_SLACK | GET_RESERVE);
+                }
+                else if (alliedunit(v, f, HELP_MONEY))
+                    mask = (mode >> 6) & (GET_SLACK | GET_RESERVE);
+                else
+                    continue;
+                use += get_pooled(v, rtype, mask, count - use);
             }
     }
     return use;
diff --git a/src/kernel/pool.h b/src/kernel/pool.h
index 695dfb28c..d72a74cbb 100644
--- a/src/kernel/pool.h
+++ b/src/kernel/pool.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -27,7 +27,7 @@ extern "C" {
     struct item_type;
     struct region;
 
-/* bitfield values for get/use/change operations */
+    /* bitfield values for get/use/change operations */
 #define GET_SLACK      0x01
 #define GET_RESERVE    0x02
 
@@ -37,29 +37,29 @@ extern "C" {
 #define GET_ALLIED_SLACK    0x40
 #define GET_ALLIED_RESERVE  0x80
 
-/* for convenience: */
+    /* for convenience: */
 #define GET_DEFAULT (GET_RESERVE|GET_SLACK|GET_POOLED_SLACK)
 #define GET_ALL (GET_SLACK|GET_RESERVE|GET_POOLED_SLACK|GET_POOLED_RESERVE|GET_POOLED_FORCE)
 
-  int get_pooled(const struct unit *u, const struct resource_type *res,
-    unsigned int mode, int count);
-  int use_pooled(struct unit *u, const struct resource_type *res,
-    unsigned int mode, int count);
-        /** use_pooled
-	 * verbraucht 'count' Objekte der resource 'itm'
-	 * unter zuhilfenahme des Pools der struct region und Aufbrauch des
-	 * von der Einheit reservierten Resourcen
-	 */
+    int get_pooled(const struct unit *u, const struct resource_type *res,
+        unsigned int mode, int count);
+    int use_pooled(struct unit *u, const struct resource_type *res,
+        unsigned int mode, int count);
+    /** use_pooled
+     * verbraucht 'count' Objekte der resource 'itm'
+     * unter zuhilfenahme des Pools der struct region und Aufbrauch des
+     * von der Einheit reservierten Resourcen
+     */
 
-  int get_resource(const struct unit *u, const struct resource_type *res);
-  int change_resource(struct unit *u, const struct resource_type *res,
-    int change);
+    int get_resource(const struct unit *u, const struct resource_type *res);
+    int change_resource(struct unit *u, const struct resource_type *res,
+        int change);
 
-  int get_reservation(const struct unit *u, const struct item_type *res);
-  int change_reservation(struct unit *u, const struct item_type *res,
-    int value);
+    int get_reservation(const struct unit *u, const struct item_type *res);
+    int change_reservation(struct unit *u, const struct item_type *res,
+        int value);
 
-  int set_resvalue(struct unit * u, const struct item_type * rtype, int value);
+    int set_resvalue(struct unit * u, const struct item_type * rtype, int value);
 
 #ifdef __cplusplus
 }
diff --git a/src/kernel/race.c b/src/kernel/race.c
index 2919fdb8b..bb4902e50 100644
--- a/src/kernel/race.c
+++ b/src/kernel/race.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/kernel/race.h b/src/kernel/race.h
index fa61e4cec..f820ae115 100644
--- a/src/kernel/race.h
+++ b/src/kernel/race.h
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/kernel/region.c b/src/kernel/region.c
index 21bc7e819..c48859a1c 100644
--- a/src/kernel/region.c
+++ b/src/kernel/region.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/kernel/region.h b/src/kernel/region.h
index df3f99b4d..30c6e2c9b 100644
--- a/src/kernel/region.h
+++ b/src/kernel/region.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -26,8 +26,8 @@ extern "C" {
 #include "types.h"
 #include "direction.h"
 
-/* FAST_CONNECT: regions are directly connected to neighbours, saves doing
-   a hash-access each time a neighbour is needed, 6 extra pointers per hex */
+    /* FAST_CONNECT: regions are directly connected to neighbours, saves doing
+       a hash-access each time a neighbour is needed, 6 extra pointers per hex */
 #define FAST_CONNECT
 
 #define RF_CHAOTIC     (1<<0) /* persistent */
@@ -59,11 +59,11 @@ extern "C" {
 #define RF_ALL 0xFFFFFF
 
 #define RF_SAVEMASK (RF_CHAOTIC|RF_MALLORN|RF_BLOCKED|RF_ENCOUNTER|RF_ORCIFIED|RF_GUARDED)
-  struct message;
-  struct message_list;
-  struct rawmaterial;
-  struct donation;
-  struct item;
+    struct message;
+    struct message_list;
+    struct rawmaterial;
+    struct donation;
+    struct item;
 
 #define MORALE_TAX_FACTOR 0.005 /* 0.5% tax per point of morale */
 #define MORALE_MAX 10           /* Maximum morale allowed */
@@ -74,139 +74,139 @@ extern "C" {
 #define MORALE_TRANSFER 2       /* points of morale lost when GIVE COMMAND */
 
 #define OWNER_MOURNING 0x01
-  typedef struct region_owner {
-    struct faction *owner;
-    struct alliance *alliance;
-    int since_turn;             /* turn the region changed owners */
-    int morale_turn;            /* turn when morale has changed most recently */
-    int flags;
-  } region_owner;
+    typedef struct region_owner {
+        struct faction *owner;
+        struct alliance *alliance;
+        int since_turn;             /* turn the region changed owners */
+        int morale_turn;            /* turn when morale has changed most recently */
+        int flags;
+    } region_owner;
 
-  typedef struct demand {
-    struct demand *next;
-    const struct luxury_type *type;
-    int value;
-  } demand;
+    typedef struct demand {
+        struct demand *next;
+        const struct luxury_type *type;
+        int value;
+    } demand;
 
-  typedef struct land_region {
-    char *name;
-    /* TODO: demand kann nach Konvertierung entfernt werden. */
-    demand *demands;
-    const struct item_type *herbtype;
-    short herbs;
-    short morale;
-    int trees[3];               /* 0 -> seeds, 1 -> shoots, 2 -> trees */
-    int horses;
-    int peasants;
-    int newpeasants;
-    int money;
-    struct item *items;         /* items that can be claimed */
-    struct region_owner *ownership;
-  } land_region;
+    typedef struct land_region {
+        char *name;
+        /* TODO: demand kann nach Konvertierung entfernt werden. */
+        demand *demands;
+        const struct item_type *herbtype;
+        short herbs;
+        short morale;
+        int trees[3];               /* 0 -> seeds, 1 -> shoots, 2 -> trees */
+        int horses;
+        int peasants;
+        int newpeasants;
+        int money;
+        struct item *items;         /* items that can be claimed */
+        struct region_owner *ownership;
+    } land_region;
 
-  typedef struct donation {
-    struct donation *next;
-    struct faction *f1, *f2;
-    int amount;
-  } donation;
+    typedef struct donation {
+        struct donation *next;
+        struct faction *f1, *f2;
+        int amount;
+    } donation;
 
-  typedef struct region {
-    struct region *next;
-    struct land_region *land;
-    struct unit *units;
-    struct ship *ships;
-    struct building *buildings;
-    unsigned int index;
-    /* an ascending number, to improve the speed of determining the interval in 
-       which a faction has its units. See the implementations of firstregion 
-       and lastregion */
-    int uid;           /* a unique id */
-    int x, y;
-    struct plane *_plane;       /* to access, use rplane(r) */
-    char *display;
-    int flags;
-    unsigned short age;
-    struct message_list *msgs;
-    struct individual_message {
-      struct individual_message *next;
-      const struct faction *viewer;
-      struct message_list *msgs;
-    } *individual_messages;
-    struct attrib *attribs;
-    struct donation *donations;
-    const struct terrain_type *terrain;
-    struct rawmaterial *resources;
+    typedef struct region {
+        struct region *next;
+        struct land_region *land;
+        struct unit *units;
+        struct ship *ships;
+        struct building *buildings;
+        unsigned int index;
+        /* an ascending number, to improve the speed of determining the interval in
+           which a faction has its units. See the implementations of firstregion
+           and lastregion */
+        int uid;           /* a unique id */
+        int x, y;
+        struct plane *_plane;       /* to access, use rplane(r) */
+        char *display;
+        int flags;
+        unsigned short age;
+        struct message_list *msgs;
+        struct individual_message {
+            struct individual_message *next;
+            const struct faction *viewer;
+            struct message_list *msgs;
+        } *individual_messages;
+        struct attrib *attribs;
+        struct donation *donations;
+        const struct terrain_type *terrain;
+        struct rawmaterial *resources;
 #ifdef FAST_CONNECT
-    struct region *connect[MAXDIRECTIONS];      /* use rconnect(r, dir) to access */
+        struct region *connect[MAXDIRECTIONS];      /* use rconnect(r, dir) to access */
 #endif
-  } region;
+    } region;
 
-  extern struct region *regions;
+    extern struct region *regions;
 
-  typedef struct region_list {
-    struct region_list *next;
-    struct region *data;
-  } region_list;
+    typedef struct region_list {
+        struct region_list *next;
+        struct region *data;
+    } region_list;
 
-  struct message_list *r_getmessages(const struct region *r,
-    const struct faction *viewer);
-  struct message *r_addmessage(struct region *r, const struct faction *viewer,
+    struct message_list *r_getmessages(const struct region *r,
+        const struct faction *viewer);
+    struct message *r_addmessage(struct region *r, const struct faction *viewer,
     struct message *msg);
 
-  typedef struct {
-    direction_t dir;
-  } moveblock;
+    typedef struct {
+        direction_t dir;
+    } moveblock;
 
 #define reg_hashkey(r) (r->index)
 
-  int distance(const struct region *, const struct region *);
-  int koor_distance(int ax, int ay, int bx, int by);
-  struct region *findregion(int x, int y);
-  struct region *findregionbyid(int uid);
+    int distance(const struct region *, const struct region *);
+    int koor_distance(int ax, int ay, int bx, int by);
+    struct region *findregion(int x, int y);
+    struct region *findregionbyid(int uid);
 
-  extern struct attrib_type at_moveblock;
-  extern struct attrib_type at_peasantluck;
-  extern struct attrib_type at_horseluck;
-  extern struct attrib_type at_woodcount;
-  extern struct attrib_type at_deathcount;
-  extern struct attrib_type at_travelunit;
+    extern struct attrib_type at_moveblock;
+    extern struct attrib_type at_peasantluck;
+    extern struct attrib_type at_horseluck;
+    extern struct attrib_type at_woodcount;
+    extern struct attrib_type at_deathcount;
+    extern struct attrib_type at_travelunit;
 
-  void initrhash(void);
-  void rhash(struct region *r);
-  void runhash(struct region *r);
+    void initrhash(void);
+    void rhash(struct region *r);
+    void runhash(struct region *r);
 
-  void free_regionlist(region_list * rl);
-  void add_regionlist(region_list ** rl, struct region *r);
+    void free_regionlist(region_list * rl);
+    void add_regionlist(region_list ** rl, struct region *r);
 
-  int deathcount(const struct region *r);
-  int chaoscount(const struct region *r);
+    int deathcount(const struct region *r);
+    int chaoscount(const struct region *r);
 
-  void deathcounts(struct region *r, int delta);
-  void chaoscounts(struct region *r, int delta);
+    void deathcounts(struct region *r, int delta);
+    void chaoscounts(struct region *r, int delta);
 
-  void setluxuries(struct region *r, const struct luxury_type *sale);
-  int get_maxluxuries(void);
+    void setluxuries(struct region *r, const struct luxury_type *sale);
+    int get_maxluxuries(void);
 
-  short rroad(const struct region *r, direction_t d);
-  void rsetroad(struct region *r, direction_t d, short value);
+    short rroad(const struct region *r, direction_t d);
+    void rsetroad(struct region *r, direction_t d, short value);
 
-  bool is_coastregion(struct region *r);
+    bool is_coastregion(struct region *r);
 
-  int rtrees(const struct region *r, int ageclass);
-  enum {
-    TREE_SEED = 0,
-    TREE_SAPLING = 1,
-    TREE_TREE = 2
-  };
+    int rtrees(const struct region *r, int ageclass);
+    enum {
+        TREE_SEED = 0,
+        TREE_SAPLING = 1,
+        TREE_TREE = 2
+    };
 
-  int rsettrees(const struct region *r, int ageclass, int value);
+    int rsettrees(const struct region *r, int ageclass, int value);
 
-  int rpeasants(const struct region *r);
-  void rsetpeasants(struct region *r, int value);
-  int rmoney(const struct region *r);
-  void rsetmoney(struct region *r, int value);
-  int rhorses(const struct region *r);
-  void rsethorses(const struct region *r, int value);
+    int rpeasants(const struct region *r);
+    void rsetpeasants(struct region *r, int value);
+    int rmoney(const struct region *r);
+    void rsetmoney(struct region *r, int value);
+    int rhorses(const struct region *r);
+    void rsethorses(const struct region *r, int value);
 
 #define rbuildings(r) ((r)->buildings)
 
@@ -216,70 +216,70 @@ extern "C" {
 #define rherbs(r) ((r)->land?(r)->land->herbs:0)
 #define rsetherbs(r, value) if ((r)->land) ((r)->land->herbs=(short)(value))
 
-  bool r_isforest(const struct region *r);
+    bool r_isforest(const struct region *r);
 
 #define rterrain(r) (oldterrain((r)->terrain))
 #define rsetterrain(r, t) ((r)->terrain = newterrain(t))
 
-  const char *rname(const struct region *r, const struct locale *lang);
+    const char *rname(const struct region *r, const struct locale *lang);
 
 #define rplane(r) getplane(r)
 
-  void r_setdemand(struct region *r, const struct luxury_type *ltype,
-    int value);
-  int r_demand(const struct region *r, const struct luxury_type *ltype);
+    void r_setdemand(struct region *r, const struct luxury_type *ltype,
+        int value);
+    int r_demand(const struct region *r, const struct luxury_type *ltype);
 
-  const char *write_regionname(const struct region *r, const struct faction *f,
-    char *buffer, size_t size);
+    const char *write_regionname(const struct region *r, const struct faction *f,
+        char *buffer, size_t size);
 
-  struct region *new_region(int x, int y, struct plane *pl, int uid);
-  void remove_region(region ** rlist, region * r);
-  void terraform_region(struct region *r, const struct terrain_type *terrain);
-  bool pnormalize(int *x, int *y, const struct plane *pl);
+    struct region *new_region(int x, int y, struct plane *pl, int uid);
+    void remove_region(region ** rlist, region * r);
+    void terraform_region(struct region *r, const struct terrain_type *terrain);
+    bool pnormalize(int *x, int *y, const struct plane *pl);
 
-  extern const int delta_x[MAXDIRECTIONS];
-  extern const int delta_y[MAXDIRECTIONS];
-  direction_t dir_invert(direction_t dir);
-  int production(const struct region *r);
+    extern const int delta_x[MAXDIRECTIONS];
+    extern const int delta_y[MAXDIRECTIONS];
+    direction_t dir_invert(direction_t dir);
+    int production(const struct region *r);
 
-  void region_set_owner(struct region *r, struct faction *owner, int turn);
-  struct faction *region_get_owner(const struct region *r);
-  struct alliance *region_get_alliance(const struct region *r);
+    void region_set_owner(struct region *r, struct faction *owner, int turn);
+    struct faction *region_get_owner(const struct region *r);
+    struct alliance *region_get_alliance(const struct region *r);
 
-  struct region *r_connect(const struct region *, direction_t dir);
+    struct region *r_connect(const struct region *, direction_t dir);
 #ifdef FAST_CONNECT
 # define rconnect(r, dir) ((r)->connect[dir]?(r)->connect[dir]:r_connect(r, (direction_t)dir))
 #else
 # define rconnect(r, dir) r_connect(r, (direction_t)dir)
 #endif
 
-  void free_regions(void);
+    void free_regions(void);
 
-  int region_get_morale(const region * r);
-  void region_set_morale(region * r, int morale, int turn);
+    int region_get_morale(const region * r);
+    void region_set_morale(region * r, int morale, int turn);
 
-  void write_region_reference(const struct region *r, struct storage *store);
-  variant read_region_reference(struct storage *store);
-  int resolve_region_coor(variant id, void *address);
-  int resolve_region_id(variant id, void *address);
+    void write_region_reference(const struct region *r, struct storage *store);
+    variant read_region_reference(struct storage *store);
+    int resolve_region_coor(variant id, void *address);
+    int resolve_region_id(variant id, void *address);
 #define RESOLVE_REGION(version) ((version<UIDHASH_VERSION)?resolve_region_coor:resolve_region_id)
 
-  const char *regionname(const struct region *r, const struct faction *f);
+    const char *regionname(const struct region *r, const struct faction *f);
 
-  const char *region_getname(const struct region *self);
-  void region_setname(struct region *self, const char *name);
-  const char *region_getinfo(const struct region *self);
-  void region_setinfo(struct region *self, const char *name);
-  int region_getresource(const struct region *r,
-    const struct resource_type *rtype);
-  void region_setresource(struct region *r, const struct resource_type *rtype,
-    int value);
-  int owner_change(const region * r);
-  bool is_mourning(const region * r, int in_turn);
-  const struct item_type *r_luxury(struct region *r);
-  void get_neighbours(const struct region *r, struct region **list);
+    const char *region_getname(const struct region *self);
+    void region_setname(struct region *self, const char *name);
+    const char *region_getinfo(const struct region *self);
+    void region_setinfo(struct region *self, const char *name);
+    int region_getresource(const struct region *r,
+        const struct resource_type *rtype);
+    void region_setresource(struct region *r, const struct resource_type *rtype,
+        int value);
+    int owner_change(const region * r);
+    bool is_mourning(const region * r, int in_turn);
+    const struct item_type *r_luxury(struct region *r);
+    void get_neighbours(const struct region *r, struct region **list);
 
-  struct faction *update_owners(struct region *r);
+    struct faction *update_owners(struct region *r);
 
 #ifdef __cplusplus
 }
diff --git a/src/kernel/render.h b/src/kernel/render.h
index abe43ec39..7d66c96de 100644
--- a/src/kernel/render.h
+++ b/src/kernel/render.h
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
                          Katja Zedel <katze@felidae.kn-bremen.de
                          Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/kernel/resources.c b/src/kernel/resources.c
index 17d07a040..d9eff6597 100644
--- a/src/kernel/resources.c
+++ b/src/kernel/resources.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/*
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -8,7 +8,7 @@
 
  This program may not be used, modified or distributed
  without prior permission by the authors of Eressea.
-*/
+ */
 
 #include <platform.h>
 #include <kernel/config.h>
@@ -29,120 +29,120 @@
 
 static double ResourceFactor(void)
 {
-  static double value = -1.0;
-  if (value < 0) {
-    const char *str = get_param(global.parameters, "resource.factor");
-    value = str ? atof(str) : 1.0;
-  }
-  return value;
+    static double value = -1.0;
+    if (value < 0) {
+        const char *str = get_param(global.parameters, "resource.factor");
+        value = str ? atof(str) : 1.0;
+    }
+    return value;
 }
 
 void update_resources(region * r)
 {
-  struct rawmaterial *res = r->resources;
-  while (res) {
-    if (res->type->update)
-      res->type->update(res, r);
-    res = res->next;
-  }
+    struct rawmaterial *res = r->resources;
+    while (res) {
+        if (res->type->update)
+            res->type->update(res, r);
+        res = res->next;
+    }
 }
 
 extern int dice_rand(const char *s);
 
 static void update_resource(struct rawmaterial *res, double modifier)
 {
-  double amount = 1 + (res->level - res->startlevel) * res->divisor / 100.0;
-  amount = ResourceFactor() * res->base * amount * modifier;
-  if (amount < 1.0)
-    res->amount = 1;
-  else
-    res->amount = (int)amount;
-  assert(res->amount > 0);
+    double amount = 1 + (res->level - res->startlevel) * res->divisor / 100.0;
+    amount = ResourceFactor() * res->base * amount * modifier;
+    if (amount < 1.0)
+        res->amount = 1;
+    else
+        res->amount = (int)amount;
+    assert(res->amount > 0);
 }
 
 void
 add_resource(region * r, int level, int base, int divisor,
-  const resource_type * rtype)
+const resource_type * rtype)
 {
-  struct rawmaterial *rm = calloc(sizeof(struct rawmaterial), 1);
+    struct rawmaterial *rm = calloc(sizeof(struct rawmaterial), 1);
 
-  rm->next = r->resources;
-  r->resources = rm;
-  rm->level = level;
-  rm->startlevel = level;
-  rm->base = base;
-  rm->divisor = divisor;
-  rm->flags = 0;
-  rm->type = rmt_get(rtype);
-  update_resource(rm, 1.0);
-  rm->type->terraform(rm, r);
+    rm->next = r->resources;
+    r->resources = rm;
+    rm->level = level;
+    rm->startlevel = level;
+    rm->base = base;
+    rm->divisor = divisor;
+    rm->flags = 0;
+    rm->type = rmt_get(rtype);
+    update_resource(rm, 1.0);
+    rm->type->terraform(rm, r);
 }
 
 void terraform_resources(region * r)
 {
-  int i;
-  const terrain_type *terrain = r->terrain;
-  static int terraform_all = -1;
-  if (terraform_all<0) {
-    terraform_all = get_param_int(global.parameters, "rules.terraform.all", 0);
-  }
+    int i;
+    const terrain_type *terrain = r->terrain;
+    static int terraform_all = -1;
+    if (terraform_all < 0) {
+        terraform_all = get_param_int(global.parameters, "rules.terraform.all", 0);
+    }
 
-  if (terrain->production == NULL)
-    return;
-  for (i = 0; terrain->production[i].type; ++i) {
-    rawmaterial *rm;
-    const terrain_production *production = terrain->production + i;
-    const resource_type *rtype = production->type;
+    if (terrain->production == NULL)
+        return;
+    for (i = 0; terrain->production[i].type; ++i) {
+        rawmaterial *rm;
+        const terrain_production *production = terrain->production + i;
+        const resource_type *rtype = production->type;
 
-    for (rm = r->resources; rm; rm = rm->next) {
-      if (rm->type->rtype == rtype)
-        break;
+        for (rm = r->resources; rm; rm = rm->next) {
+            if (rm->type->rtype == rtype)
+                break;
+        }
+        if (rm) {
+            continue;
+        }
+
+        if (terraform_all || chance(production->chance)) {
+            add_resource(r, dice_rand(production->startlevel),
+                dice_rand(production->base), dice_rand(production->divisor),
+                production->type);
+        }
     }
-    if (rm) {
-      continue;
-    }
-    
-    if (terraform_all || chance(production->chance)) {
-      add_resource(r, dice_rand(production->startlevel),
-        dice_rand(production->base), dice_rand(production->divisor),
-        production->type);
-    }
-  }
 }
 
 static void terraform_default(struct rawmaterial *res, const region * r)
 {
 #define SHIFT 70
-  double modifier =
-    1.0 + ((rng_int() % (SHIFT * 2 + 1)) - SHIFT) * ((rng_int() % (SHIFT * 2 +
+    double modifier =
+        1.0 + ((rng_int() % (SHIFT * 2 + 1)) - SHIFT) * ((rng_int() % (SHIFT * 2 +
         1)) - SHIFT) / 10000.0;
-  res->amount = (int)(res->amount * modifier);  /* random adjustment, +/- 91% */
-  if (res->amount < 1)
-    res->amount = 1;
-  unused_arg(r);
+    res->amount = (int)(res->amount * modifier);  /* random adjustment, +/- 91% */
+    if (res->amount < 1)
+        res->amount = 1;
+    unused_arg(r);
 }
 
 #ifdef RANDOM_CHANGE
 static void resource_random_change(int *pvalue, bool used)
 {
-  int split = 5;
-  int rnd = rng_int() % 100;
+    int split = 5;
+    int rnd = rng_int() % 100;
 
-  if (pvalue == 0 || rnd % 10 >= 10)
-    return;
-  if (used)
-    split = 4;
-  /* if a resource was mined this round, there is a 6% probability
-   * of a decline and a 4% probability of a raise. */
-  /* if it wasn't mined this round, there is an equal probability
-   * of 5% for a decline or a raise. */
-  if (rnd < split) {
-    (*pvalue)++;
-  } else {
-    (*pvalue)--;
-  }
-  if ((*pvalue) < 0)
-    (*pvalue) = 0;
+    if (pvalue == 0 || rnd % 10 >= 10)
+        return;
+    if (used)
+        split = 4;
+    /* if a resource was mined this round, there is a 6% probability
+     * of a decline and a 4% probability of a raise. */
+    /* if it wasn't mined this round, there is an equal probability
+     * of 5% for a decline or a raise. */
+    if (rnd < split) {
+        (*pvalue)++;
+    } else {
+        (*pvalue)--;
+    }
+    if ((*pvalue) < 0)
+        (*pvalue) = 0;
 }
 #endif
 
@@ -150,75 +150,76 @@ static int visible_default(const rawmaterial * res, int skilllevel)
 /* resources are visible, if skill equals minimum skill to mine them
  * plus current level of difficulty */
 {
-  const struct item_type *itype = res->type->rtype->itype;
-  if (res->level <= 1
-    && res->level + itype->construction->minskill <= skilllevel + 1) {
-    assert(res->amount > 0);
-    return res->amount;
-  } else if (res->level + itype->construction->minskill <= skilllevel + 2) {
-    assert(res->amount > 0);
-    return res->amount;
-  }
-  return -1;
+    const struct item_type *itype = res->type->rtype->itype;
+    if (res->level <= 1
+        && res->level + itype->construction->minskill <= skilllevel + 1) {
+        assert(res->amount > 0);
+        return res->amount;
+    }
+    else if (res->level + itype->construction->minskill <= skilllevel + 2) {
+        assert(res->amount > 0);
+        return res->amount;
+    }
+    return -1;
 }
 
 static void use_default(rawmaterial * res, const region * r, int amount)
 {
-  assert(res->amount > 0 && amount >= 0 && amount <= res->amount);
-  res->amount -= amount;
-  while (res->amount == 0) {
-    double modifier =
-      1.0 + ((rng_int() % (SHIFT * 2 + 1)) - SHIFT) * ((rng_int() % (SHIFT * 2 +
-          1)) - SHIFT) / 10000.0;
-    int i;
+    assert(res->amount > 0 && amount >= 0 && amount <= res->amount);
+    res->amount -= amount;
+    while (res->amount == 0) {
+        double modifier =
+            1.0 + ((rng_int() % (SHIFT * 2 + 1)) - SHIFT) * ((rng_int() % (SHIFT * 2 +
+            1)) - SHIFT) / 10000.0;
+        int i;
 
-    for (i = 0; r->terrain->production[i].type; ++i) {
-      if (res->type->rtype == r->terrain->production[i].type)
-        break;
+        for (i = 0; r->terrain->production[i].type; ++i) {
+            if (res->type->rtype == r->terrain->production[i].type)
+                break;
+        }
+
+        ++res->level;
+        update_resource(res, modifier);
     }
-
-    ++res->level;
-    update_resource(res, modifier);
-  }
 }
 
 struct rawmaterial *rm_get(region * r, const struct resource_type *rtype)
 {
-  struct rawmaterial *rm = r->resources;
-  while (rm && rm->type->rtype != rtype)
-    rm = rm->next;
-  return rm;
+    struct rawmaterial *rm = r->resources;
+    while (rm && rm->type->rtype != rtype)
+        rm = rm->next;
+    return rm;
 }
 
 struct rawmaterial_type *rawmaterialtypes = 0;
 
 struct rawmaterial_type *rmt_find(const char *str)
 {
-  rawmaterial_type *rmt = rawmaterialtypes;
-  while (rmt && strcmp(rmt->name, str) != 0)
-    rmt = rmt->next;
-  return rmt;
+    rawmaterial_type *rmt = rawmaterialtypes;
+    while (rmt && strcmp(rmt->name, str) != 0)
+        rmt = rmt->next;
+    return rmt;
 }
 
 struct rawmaterial_type *rmt_get(const struct resource_type *rtype)
 {
-  rawmaterial_type *rmt = rawmaterialtypes;
-  while (rmt && rmt->rtype != rtype)
-    rmt = rmt->next;
-  return rmt;
+    rawmaterial_type *rmt = rawmaterialtypes;
+    while (rmt && rmt->rtype != rtype)
+        rmt = rmt->next;
+    return rmt;
 }
 
 struct rawmaterial_type *rmt_create(const struct resource_type *rtype,
-  const char *name)
+    const char *name)
 {
-  rawmaterial_type *rmtype = malloc(sizeof(rawmaterial_type));
-  rmtype->name = _strdup(name);
-  rmtype->rtype = rtype;
-  rmtype->terraform = terraform_default;
-  rmtype->update = NULL;
-  rmtype->use = use_default;
-  rmtype->visible = visible_default;
-  rmtype->next = rawmaterialtypes;
-  rawmaterialtypes = rmtype;
-  return rmtype;
+    rawmaterial_type *rmtype = malloc(sizeof(rawmaterial_type));
+    rmtype->name = _strdup(name);
+    rmtype->rtype = rtype;
+    rmtype->terraform = terraform_default;
+    rmtype->update = NULL;
+    rmtype->use = use_default;
+    rmtype->visible = visible_default;
+    rmtype->next = rawmaterialtypes;
+    rawmaterialtypes = rmtype;
+    return rmtype;
 }
diff --git a/src/kernel/resources.h b/src/kernel/resources.h
index ace16a177..32c69036c 100644
--- a/src/kernel/resources.h
+++ b/src/kernel/resources.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/*
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -6,68 +6,68 @@
  |                   |  Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
  +-------------------+  Stefan Reich <reich@halbling.de>
 
- This program may not be used, modified or distributed 
+ This program may not be used, modified or distributed
  without prior permission by the authors of Eressea.
-*/
+ */
 #ifndef H_KRNL_RESOURCES
 #define H_KRNL_RESOURCES
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-  enum {
-    RM_USED = 1 << 0,           /* resource has been used */
-    RM_MALLORN = 1 << 1         /* this is not wood. it's mallorn */
-  };
+    enum {
+        RM_USED = 1 << 0,           /* resource has been used */
+        RM_MALLORN = 1 << 1         /* this is not wood. it's mallorn */
+    };
 
-  typedef struct rawmaterial {
-    const struct rawmaterial_type *type;
+    typedef struct rawmaterial {
+        const struct rawmaterial_type *type;
 #ifdef LOMEM
-    int amount:16;
-    int level:8;
-    int flags:8;
-    int base:8;
-    int divisor:8;
-    int startlevel:8;
+        int amount:16;
+        int level:8;
+        int flags:8;
+        int base:8;
+        int divisor:8;
+        int startlevel:8;
 #else
-    int amount;
-    int level;
-    int flags;
-    int base;
-    int divisor;
-    int startlevel;
+        int amount;
+        int level;
+        int flags;
+        int base;
+        int divisor;
+        int startlevel;
 #endif
-    struct rawmaterial *next;
-  } rawmaterial;
+        struct rawmaterial *next;
+    } rawmaterial;
 
-  typedef struct rawmaterial_type {
-    char *name;
-    const struct resource_type *rtype;
+    typedef struct rawmaterial_type {
+        char *name;
+        const struct resource_type *rtype;
 
-    void (*terraform) (struct rawmaterial *, const struct region *);
-    void (*update) (struct rawmaterial *, const struct region *);
-    void (*use) (struct rawmaterial *, const struct region *, int amount);
-    int (*visible) (const struct rawmaterial *, int skilllevel);
+        void(*terraform) (struct rawmaterial *, const struct region *);
+        void(*update) (struct rawmaterial *, const struct region *);
+        void(*use) (struct rawmaterial *, const struct region *, int amount);
+        int(*visible) (const struct rawmaterial *, int skilllevel);
 
-    /* no initialization required */
-    struct rawmaterial_type *next;
-  } rawmaterial_type;
+        /* no initialization required */
+        struct rawmaterial_type *next;
+    } rawmaterial_type;
 
-  extern struct rawmaterial_type *rawmaterialtypes;
+    extern struct rawmaterial_type *rawmaterialtypes;
 
-  extern void update_resources(struct region *r);
-  extern void terraform_resources(struct region *r);
-  extern void read_resources(struct region *r);
-  extern void write_resources(struct region *r);
-  extern struct rawmaterial *rm_get(struct region *,
-    const struct resource_type *);
-  extern struct rawmaterial_type *rmt_find(const char *str);
-  extern struct rawmaterial_type *rmt_get(const struct resource_type *);
+    extern void update_resources(struct region *r);
+    extern void terraform_resources(struct region *r);
+    extern void read_resources(struct region *r);
+    extern void write_resources(struct region *r);
+    extern struct rawmaterial *rm_get(struct region *,
+        const struct resource_type *);
+    extern struct rawmaterial_type *rmt_find(const char *str);
+    extern struct rawmaterial_type *rmt_get(const struct resource_type *);
 
-  extern void add_resource(struct region *r, int level, int base, int divisor,
-    const struct resource_type *rtype);
-  extern struct rawmaterial_type *rmt_create(const struct resource_type *rtype,
-    const char *name);
+    extern void add_resource(struct region *r, int level, int base, int divisor,
+        const struct resource_type *rtype);
+    extern struct rawmaterial_type *rmt_create(const struct resource_type *rtype,
+        const char *name);
 
 #ifdef __cplusplus
 }
diff --git a/src/kernel/save.c b/src/kernel/save.c
index 059f960ad..e4cb5416c 100644
--- a/src/kernel/save.c
+++ b/src/kernel/save.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
@@ -1847,7 +1847,7 @@ int writegame(const char *filename)
 
     log_printf(stdout, "\nOk.\n");
     return 0;
-    }
+}
 
 int a_readint(attrib * a, void *owner, struct storage *store)
 {
diff --git a/src/kernel/save.h b/src/kernel/save.h
index 512946aca..8a14a93ac 100644
--- a/src/kernel/save.h
+++ b/src/kernel/save.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -30,56 +30,56 @@ extern "C" {
     struct spell;
     struct spellbook;
     struct unit;
-    
-  typedef struct gamedata {
-    struct storage *store;
-    stream strm;
-    int version;
-    int encoding;
-  } gamedata;
+
+    typedef struct gamedata {
+        struct storage *store;
+        stream strm;
+        int version;
+        int encoding;
+    } gamedata;
 
 #define MAX_INPUT_SIZE	DISPLAYSIZE*2
-/* Nach MAX_INPUT_SIZE brechen wir das Einlesen der Zeile ab und nehmen an,
- * dass hier ein Fehler (fehlende ") vorliegt */
+    /* Nach MAX_INPUT_SIZE brechen wir das Einlesen der Zeile ab und nehmen an,
+     * dass hier ein Fehler (fehlende ") vorliegt */
 
-  int readorders(const char *filename);
-  int creategame(void);
-  int readgame(const char *filename, int backup);
-  int writegame(const char *filename);
+    int readorders(const char *filename);
+    int creategame(void);
+    int readgame(const char *filename, int backup);
+    int writegame(const char *filename);
 
-/* Versions�nderungen: */
-  extern int data_version;
-  extern int enc_gamedata;
+    /* Versions�nderungen: */
+    extern int data_version;
+    extern int enc_gamedata;
 
-  extern int current_turn(void);
+    extern int current_turn(void);
 
-  extern void read_items(struct storage *store, struct item **it);
-  extern void write_items(struct storage *store, struct item *it);
+    extern void read_items(struct storage *store, struct item **it);
+    extern void write_items(struct storage *store, struct item *it);
 
-  extern void read_spellbook(struct spellbook **bookp, struct storage *store, int (*get_level)(const struct spell * sp, void *), void * cbdata);
-  extern void write_spellbook(const struct spellbook *book, struct storage *store);
+    extern void read_spellbook(struct spellbook **bookp, struct storage *store, int(*get_level)(const struct spell * sp, void *), void * cbdata);
+    extern void write_spellbook(const struct spellbook *book, struct storage *store);
 
-  extern void write_unit(struct gamedata *data, const struct unit *u);
-  extern struct unit *read_unit(struct gamedata *data);
+    extern void write_unit(struct gamedata *data, const struct unit *u);
+    extern struct unit *read_unit(struct gamedata *data);
 
-  extern int a_readint(struct attrib *a, void *owner, struct storage *store);
-  extern void a_writeint(const struct attrib *a, const void *owner,
+    extern int a_readint(struct attrib *a, void *owner, struct storage *store);
+    extern void a_writeint(const struct attrib *a, const void *owner,
     struct storage *store);
-  extern int a_readshorts(struct attrib *a, void *owner, struct storage *store);
-  extern void a_writeshorts(const struct attrib *a, const void *owner,
+    extern int a_readshorts(struct attrib *a, void *owner, struct storage *store);
+    extern void a_writeshorts(const struct attrib *a, const void *owner,
     struct storage *store);
-  extern int a_readchars(struct attrib *a, void *owner, struct storage *store);
-  extern void a_writechars(const struct attrib *a, const void *owner,
+    extern int a_readchars(struct attrib *a, void *owner, struct storage *store);
+    extern void a_writechars(const struct attrib *a, const void *owner,
     struct storage *store);
-  extern int a_readvoid(struct attrib *a, void *owner, struct storage *store);
-  extern void a_writevoid(const struct attrib *a, const void *owner,
+    extern int a_readvoid(struct attrib *a, void *owner, struct storage *store);
+    extern void a_writevoid(const struct attrib *a, const void *owner,
     struct storage *store);
-  extern int a_readstring(struct attrib *a, void *owner, struct storage *store);
-  extern void a_writestring(const struct attrib *a, const void *owner,
+    extern int a_readstring(struct attrib *a, void *owner, struct storage *store);
+    extern void a_writestring(const struct attrib *a, const void *owner,
     struct storage *store);
-  extern void a_finalizestring(struct attrib *a);
+    extern void a_finalizestring(struct attrib *a);
 
-  extern void create_backup(char *file);
+    extern void create_backup(char *file);
 
 #ifdef __cplusplus
 }
diff --git a/src/kernel/ship.c b/src/kernel/ship.c
index 19f3fa743..f30658024 100644
--- a/src/kernel/ship.c
+++ b/src/kernel/ship.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/kernel/ship.h b/src/kernel/ship.h
index ac132cc35..266973ed0 100644
--- a/src/kernel/ship.h
+++ b/src/kernel/ship.h
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/kernel/ship.test.c b/src/kernel/ship.test.c
index 86d0b8597..36ba9a6ff 100644
--- a/src/kernel/ship.test.c
+++ b/src/kernel/ship.test.c
@@ -13,347 +13,347 @@
 
 static void test_register_ship(CuTest * tc)
 {
-  ship_type *stype;
+    ship_type *stype;
 
-  test_cleanup();
+    test_cleanup();
 
-  stype = st_get_or_create("herp");
-  CuAssertPtrNotNull(tc, stype);
-  CuAssertPtrEquals(tc, stype, (void *)st_find("herp"));
+    stype = st_get_or_create("herp");
+    CuAssertPtrNotNull(tc, stype);
+    CuAssertPtrEquals(tc, stype, (void *)st_find("herp"));
 }
 
 static void test_ship_set_owner(CuTest * tc)
 {
-  struct region *r;
-  struct ship *sh;
-  struct unit *u1, *u2;
-  struct faction *f;
-  const struct ship_type *stype;
-  const struct race *human;
+    struct region *r;
+    struct ship *sh;
+    struct unit *u1, *u2;
+    struct faction *f;
+    const struct ship_type *stype;
+    const struct race *human;
 
-  test_cleanup();
-  test_create_world();
+    test_cleanup();
+    test_create_world();
 
-  human = rc_find("human");
-  stype = st_find("boat");
-  f = test_create_faction(human);
-  r = findregion(0, 0);
+    human = rc_find("human");
+    stype = st_find("boat");
+    f = test_create_faction(human);
+    r = findregion(0, 0);
 
-  sh = test_create_ship(r, stype);
-  u1 = test_create_unit(f, r);
-  u_set_ship(u1, sh);
-  CuAssertPtrEquals(tc, u1, ship_owner(sh));
+    sh = test_create_ship(r, stype);
+    u1 = test_create_unit(f, r);
+    u_set_ship(u1, sh);
+    CuAssertPtrEquals(tc, u1, ship_owner(sh));
 
-  u2 = test_create_unit(f, r);
-  u_set_ship(u2, sh);
-  CuAssertPtrEquals(tc, u1, ship_owner(sh));
-  ship_set_owner(u2);
-  CuAssertPtrEquals(tc, u2, ship_owner(sh));
+    u2 = test_create_unit(f, r);
+    u_set_ship(u2, sh);
+    CuAssertPtrEquals(tc, u1, ship_owner(sh));
+    ship_set_owner(u2);
+    CuAssertPtrEquals(tc, u2, ship_owner(sh));
 }
 
 static void test_shipowner_goes_to_next_when_empty(CuTest * tc)
 {
-  struct region *r;
-  struct ship *sh;
-  struct unit *u, *u2;
-  struct faction *f;
-  const struct ship_type *stype;
-  const struct race *human;
+    struct region *r;
+    struct ship *sh;
+    struct unit *u, *u2;
+    struct faction *f;
+    const struct ship_type *stype;
+    const struct race *human;
 
-  test_cleanup();
-  test_create_world();
+    test_cleanup();
+    test_create_world();
 
-  human = rc_find("human");
-  CuAssertPtrNotNull(tc, human);
+    human = rc_find("human");
+    CuAssertPtrNotNull(tc, human);
 
-  stype = st_find("boat");
-  CuAssertPtrNotNull(tc, stype);
+    stype = st_find("boat");
+    CuAssertPtrNotNull(tc, stype);
 
-  f = test_create_faction(human);
-  r = findregion(0, 0);
+    f = test_create_faction(human);
+    r = findregion(0, 0);
 
-  sh = test_create_ship(r, stype);
-  CuAssertPtrNotNull(tc, sh);
+    sh = test_create_ship(r, stype);
+    CuAssertPtrNotNull(tc, sh);
 
-  u = test_create_unit(f, r);
-  u2 = test_create_unit(f, r);
-  CuAssertPtrNotNull(tc, u);
-  u_set_ship(u, sh);
-  u_set_ship(u2, sh);
-  CuAssertPtrEquals(tc, u, ship_owner(sh));
-  u->number = 0;
-  CuAssertPtrEquals(tc, u2, ship_owner(sh));
+    u = test_create_unit(f, r);
+    u2 = test_create_unit(f, r);
+    CuAssertPtrNotNull(tc, u);
+    u_set_ship(u, sh);
+    u_set_ship(u2, sh);
+    CuAssertPtrEquals(tc, u, ship_owner(sh));
+    u->number = 0;
+    CuAssertPtrEquals(tc, u2, ship_owner(sh));
 }
 
 static void test_shipowner_goes_to_other_when_empty(CuTest * tc)
 {
-  struct region *r;
-  struct ship *sh;
-  struct unit *u, *u2;
-  struct faction *f;
-  const struct ship_type *stype;
-  const struct race *human;
+    struct region *r;
+    struct ship *sh;
+    struct unit *u, *u2;
+    struct faction *f;
+    const struct ship_type *stype;
+    const struct race *human;
 
-  test_cleanup();
-  test_create_world();
+    test_cleanup();
+    test_create_world();
 
-  human = rc_find("human");
-  CuAssertPtrNotNull(tc, human);
+    human = rc_find("human");
+    CuAssertPtrNotNull(tc, human);
 
-  stype = st_find("boat");
-  CuAssertPtrNotNull(tc, stype);
+    stype = st_find("boat");
+    CuAssertPtrNotNull(tc, stype);
 
-  f = test_create_faction(human);
-  r = findregion(0, 0);
+    f = test_create_faction(human);
+    r = findregion(0, 0);
 
-  sh = test_create_ship(r, stype);
-  CuAssertPtrNotNull(tc, sh);
+    sh = test_create_ship(r, stype);
+    CuAssertPtrNotNull(tc, sh);
 
-  u2 = test_create_unit(f, r);
-  u = test_create_unit(f, r);
-  CuAssertPtrNotNull(tc, u);
-  u_set_ship(u, sh);
-  u_set_ship(u2, sh);
-  CuAssertPtrEquals(tc, u, ship_owner(sh));
-  u->number = 0;
-  CuAssertPtrEquals(tc, u2, ship_owner(sh));
+    u2 = test_create_unit(f, r);
+    u = test_create_unit(f, r);
+    CuAssertPtrNotNull(tc, u);
+    u_set_ship(u, sh);
+    u_set_ship(u2, sh);
+    CuAssertPtrEquals(tc, u, ship_owner(sh));
+    u->number = 0;
+    CuAssertPtrEquals(tc, u2, ship_owner(sh));
 }
 
 static void test_shipowner_goes_to_same_faction_when_empty(CuTest * tc)
 {
-  struct region *r;
-  struct ship *sh;
-  struct unit *u, *u2, *u3;
-  struct faction *f1, *f2;
-  const struct ship_type *stype;
-  const struct race *human;
+    struct region *r;
+    struct ship *sh;
+    struct unit *u, *u2, *u3;
+    struct faction *f1, *f2;
+    const struct ship_type *stype;
+    const struct race *human;
 
-  test_cleanup();
-  test_create_world();
+    test_cleanup();
+    test_create_world();
 
-  human = rc_find("human");
-  CuAssertPtrNotNull(tc, human);
+    human = rc_find("human");
+    CuAssertPtrNotNull(tc, human);
 
-  stype = st_find("boat");
-  CuAssertPtrNotNull(tc, stype);
+    stype = st_find("boat");
+    CuAssertPtrNotNull(tc, stype);
 
-  f1 = test_create_faction(human);
-  f2 = test_create_faction(human);
-  r = findregion(0, 0);
+    f1 = test_create_faction(human);
+    f2 = test_create_faction(human);
+    r = findregion(0, 0);
 
-  sh = test_create_ship(r, stype);
-  CuAssertPtrNotNull(tc, sh);
+    sh = test_create_ship(r, stype);
+    CuAssertPtrNotNull(tc, sh);
 
-  u2 = test_create_unit(f2, r);
-  u3 = test_create_unit(f1, r);
-  u = test_create_unit(f1, r);
-  CuAssertPtrNotNull(tc, u);
-  u_set_ship(u, sh);
-  u_set_ship(u2, sh);
-  u_set_ship(u3, sh);
-  CuAssertPtrEquals(tc, u, ship_owner(sh));
-  u->number = 0;
-  CuAssertPtrEquals(tc, u3, ship_owner(sh));
-  u3->number = 0;
-  CuAssertPtrEquals(tc, u2, ship_owner(sh));
+    u2 = test_create_unit(f2, r);
+    u3 = test_create_unit(f1, r);
+    u = test_create_unit(f1, r);
+    CuAssertPtrNotNull(tc, u);
+    u_set_ship(u, sh);
+    u_set_ship(u2, sh);
+    u_set_ship(u3, sh);
+    CuAssertPtrEquals(tc, u, ship_owner(sh));
+    u->number = 0;
+    CuAssertPtrEquals(tc, u3, ship_owner(sh));
+    u3->number = 0;
+    CuAssertPtrEquals(tc, u2, ship_owner(sh));
 }
 
 static void test_shipowner_goes_to_next_after_leave(CuTest * tc)
 {
-  struct region *r;
-  struct ship *sh;
-  struct unit *u, *u2;
-  struct faction *f;
-  const struct ship_type *stype;
-  const struct race *human;
+    struct region *r;
+    struct ship *sh;
+    struct unit *u, *u2;
+    struct faction *f;
+    const struct ship_type *stype;
+    const struct race *human;
 
-  test_cleanup();
-  test_create_world();
+    test_cleanup();
+    test_create_world();
 
-  human = rc_find("human");
-  CuAssertPtrNotNull(tc, human);
+    human = rc_find("human");
+    CuAssertPtrNotNull(tc, human);
 
-  stype = st_find("boat");
-  CuAssertPtrNotNull(tc, stype);
+    stype = st_find("boat");
+    CuAssertPtrNotNull(tc, stype);
 
-  f = test_create_faction(human);
-  r = findregion(0, 0);
+    f = test_create_faction(human);
+    r = findregion(0, 0);
 
-  sh = test_create_ship(r, stype);
-  CuAssertPtrNotNull(tc, sh);
+    sh = test_create_ship(r, stype);
+    CuAssertPtrNotNull(tc, sh);
 
-  u = test_create_unit(f, r);
-  u2 = test_create_unit(f, r);
-  CuAssertPtrNotNull(tc, u);
-  u_set_ship(u, sh);
-  u_set_ship(u2, sh);
-  CuAssertPtrEquals(tc, u, ship_owner(sh));
-  leave_ship(u);
-  CuAssertPtrEquals(tc, u2, ship_owner(sh));
+    u = test_create_unit(f, r);
+    u2 = test_create_unit(f, r);
+    CuAssertPtrNotNull(tc, u);
+    u_set_ship(u, sh);
+    u_set_ship(u2, sh);
+    CuAssertPtrEquals(tc, u, ship_owner(sh));
+    leave_ship(u);
+    CuAssertPtrEquals(tc, u2, ship_owner(sh));
 }
 
 static void test_shipowner_goes_to_other_after_leave(CuTest * tc)
 {
-  struct region *r;
-  struct ship *sh;
-  struct unit *u, *u2;
-  struct faction *f;
-  const struct ship_type *stype;
-  const struct race *human;
+    struct region *r;
+    struct ship *sh;
+    struct unit *u, *u2;
+    struct faction *f;
+    const struct ship_type *stype;
+    const struct race *human;
 
-  test_cleanup();
-  test_create_world();
+    test_cleanup();
+    test_create_world();
 
-  human = rc_find("human");
-  CuAssertPtrNotNull(tc, human);
+    human = rc_find("human");
+    CuAssertPtrNotNull(tc, human);
 
-  stype = st_find("boat");
-  CuAssertPtrNotNull(tc, stype);
+    stype = st_find("boat");
+    CuAssertPtrNotNull(tc, stype);
 
-  f = test_create_faction(human);
-  r = findregion(0, 0);
+    f = test_create_faction(human);
+    r = findregion(0, 0);
 
-  sh = test_create_ship(r, stype);
-  CuAssertPtrNotNull(tc, sh);
+    sh = test_create_ship(r, stype);
+    CuAssertPtrNotNull(tc, sh);
 
-  u2 = test_create_unit(f, r);
-  u = test_create_unit(f, r);
-  CuAssertPtrNotNull(tc, u);
-  u_set_ship(u, sh);
-  u_set_ship(u2, sh);
-  CuAssertPtrEquals(tc, u, ship_owner(sh));
-  leave_ship(u);
-  CuAssertPtrEquals(tc, u2, ship_owner(sh));
+    u2 = test_create_unit(f, r);
+    u = test_create_unit(f, r);
+    CuAssertPtrNotNull(tc, u);
+    u_set_ship(u, sh);
+    u_set_ship(u2, sh);
+    CuAssertPtrEquals(tc, u, ship_owner(sh));
+    leave_ship(u);
+    CuAssertPtrEquals(tc, u2, ship_owner(sh));
 }
 
 static void test_shipowner_goes_to_same_faction_after_leave(CuTest * tc)
 {
-  struct region *r;
-  struct ship *sh;
-  struct unit *u, *u2, *u3;
-  struct faction *f1, *f2;
-  const struct ship_type *stype;
-  const struct race *human;
+    struct region *r;
+    struct ship *sh;
+    struct unit *u, *u2, *u3;
+    struct faction *f1, *f2;
+    const struct ship_type *stype;
+    const struct race *human;
 
-  test_cleanup();
-  test_create_world();
+    test_cleanup();
+    test_create_world();
 
-  human = rc_find("human");
-  CuAssertPtrNotNull(tc, human);
+    human = rc_find("human");
+    CuAssertPtrNotNull(tc, human);
 
-  stype = st_find("boat");
-  CuAssertPtrNotNull(tc, stype);
+    stype = st_find("boat");
+    CuAssertPtrNotNull(tc, stype);
 
-  f1 = test_create_faction(human);
-  f2 = test_create_faction(human);
-  r = findregion(0, 0);
+    f1 = test_create_faction(human);
+    f2 = test_create_faction(human);
+    r = findregion(0, 0);
 
-  sh = test_create_ship(r, stype);
-  CuAssertPtrNotNull(tc, sh);
+    sh = test_create_ship(r, stype);
+    CuAssertPtrNotNull(tc, sh);
 
-  u2 = test_create_unit(f2, r);
-  u3 = test_create_unit(f1, r);
-  u = test_create_unit(f1, r);
-  CuAssertPtrNotNull(tc, u);
-  u_set_ship(u, sh);
-  u_set_ship(u2, sh);
-  u_set_ship(u3, sh);
-  CuAssertPtrEquals(tc, u, ship_owner(sh));
-  leave_ship(u);
-  CuAssertPtrEquals(tc, u3, ship_owner(sh));
-  leave_ship(u3);
-  CuAssertPtrEquals(tc, u2, ship_owner(sh));
-  leave_ship(u2);
-  CuAssertPtrEquals(tc, 0, ship_owner(sh));
+    u2 = test_create_unit(f2, r);
+    u3 = test_create_unit(f1, r);
+    u = test_create_unit(f1, r);
+    CuAssertPtrNotNull(tc, u);
+    u_set_ship(u, sh);
+    u_set_ship(u2, sh);
+    u_set_ship(u3, sh);
+    CuAssertPtrEquals(tc, u, ship_owner(sh));
+    leave_ship(u);
+    CuAssertPtrEquals(tc, u3, ship_owner(sh));
+    leave_ship(u3);
+    CuAssertPtrEquals(tc, u2, ship_owner(sh));
+    leave_ship(u2);
+    CuAssertPtrEquals(tc, 0, ship_owner(sh));
 }
 
 static void test_shipowner_resets_when_empty(CuTest * tc)
 {
-  struct region *r;
-  struct ship *sh;
-  struct unit *u;
-  struct faction *f;
-  const struct ship_type *stype;
-  const struct race *human;
+    struct region *r;
+    struct ship *sh;
+    struct unit *u;
+    struct faction *f;
+    const struct ship_type *stype;
+    const struct race *human;
 
-  test_cleanup();
-  test_create_world();
+    test_cleanup();
+    test_create_world();
 
-  human = rc_find("human");
-  CuAssertPtrNotNull(tc, human);
+    human = rc_find("human");
+    CuAssertPtrNotNull(tc, human);
 
-  stype = st_find("boat");
-  CuAssertPtrNotNull(tc, stype);
+    stype = st_find("boat");
+    CuAssertPtrNotNull(tc, stype);
 
-  f = test_create_faction(human);
-  r = findregion(0, 0);
+    f = test_create_faction(human);
+    r = findregion(0, 0);
 
-  sh = test_create_ship(r, stype);
-  CuAssertPtrNotNull(tc, sh);
+    sh = test_create_ship(r, stype);
+    CuAssertPtrNotNull(tc, sh);
 
-  u = test_create_unit(f, r);
-  CuAssertPtrNotNull(tc, u);
-  u_set_ship(u, sh);
-  CuAssertPtrEquals(tc, u, ship_owner(sh));
-  u->number = 0;
-  CuAssertPtrEquals(tc, 0, ship_owner(sh));
-  u->number = 1;
-  CuAssertPtrEquals(tc, u, ship_owner(sh));
+    u = test_create_unit(f, r);
+    CuAssertPtrNotNull(tc, u);
+    u_set_ship(u, sh);
+    CuAssertPtrEquals(tc, u, ship_owner(sh));
+    u->number = 0;
+    CuAssertPtrEquals(tc, 0, ship_owner(sh));
+    u->number = 1;
+    CuAssertPtrEquals(tc, u, ship_owner(sh));
 }
 
 void test_shipowner_goes_to_empty_unit_after_leave(CuTest * tc)
 {
-  struct region *r;
-  struct ship *sh;
-  struct unit *u1, *u2, *u3;
-  struct faction *f1;
-  const struct ship_type *stype;
-  const struct race *human;
+    struct region *r;
+    struct ship *sh;
+    struct unit *u1, *u2, *u3;
+    struct faction *f1;
+    const struct ship_type *stype;
+    const struct race *human;
 
-  test_cleanup();
-  test_create_world();
+    test_cleanup();
+    test_create_world();
 
-  human = rc_find("human");
-  CuAssertPtrNotNull(tc, human);
+    human = rc_find("human");
+    CuAssertPtrNotNull(tc, human);
 
-  stype = st_find("boat");
-  CuAssertPtrNotNull(tc, stype);
+    stype = st_find("boat");
+    CuAssertPtrNotNull(tc, stype);
 
-  f1 = test_create_faction(human);
-  r = findregion(0, 0);
+    f1 = test_create_faction(human);
+    r = findregion(0, 0);
 
-  sh = test_create_ship(r, stype);
-  CuAssertPtrNotNull(tc, sh);
+    sh = test_create_ship(r, stype);
+    CuAssertPtrNotNull(tc, sh);
 
-  u1 = test_create_unit(f1, r);
-  u2 = test_create_unit(f1, r);
-  u3 = test_create_unit(f1, r);
-  u_set_ship(u1, sh);
-  u_set_ship(u2, sh);
-  u_set_ship(u3, sh);
+    u1 = test_create_unit(f1, r);
+    u2 = test_create_unit(f1, r);
+    u3 = test_create_unit(f1, r);
+    u_set_ship(u1, sh);
+    u_set_ship(u2, sh);
+    u_set_ship(u3, sh);
 
-  CuAssertPtrEquals(tc, u1, ship_owner(sh));
-  u2->number = 0;
-  leave_ship(u1);
-  CuAssertPtrEquals(tc, u3, ship_owner(sh));
-  leave_ship(u3);
-  CuAssertPtrEquals(tc, 0, ship_owner(sh));
-  u2->number = 1;
-  CuAssertPtrEquals(tc, u2, ship_owner(sh));
+    CuAssertPtrEquals(tc, u1, ship_owner(sh));
+    u2->number = 0;
+    leave_ship(u1);
+    CuAssertPtrEquals(tc, u3, ship_owner(sh));
+    leave_ship(u3);
+    CuAssertPtrEquals(tc, 0, ship_owner(sh));
+    u2->number = 1;
+    CuAssertPtrEquals(tc, u2, ship_owner(sh));
 }
 
 CuSuite *get_ship_suite(void)
 {
-  CuSuite *suite = CuSuiteNew();
-  SUITE_ADD_TEST(suite, test_register_ship);
-  SUITE_ADD_TEST(suite, test_ship_set_owner);
-  SUITE_ADD_TEST(suite, test_shipowner_resets_when_empty);
-  SUITE_ADD_TEST(suite, test_shipowner_goes_to_next_when_empty);
-  SUITE_ADD_TEST(suite, test_shipowner_goes_to_other_when_empty);
-  SUITE_ADD_TEST(suite, test_shipowner_goes_to_same_faction_when_empty);
-  SUITE_ADD_TEST(suite, test_shipowner_goes_to_next_after_leave);
-  SUITE_ADD_TEST(suite, test_shipowner_goes_to_other_after_leave);
-  SUITE_ADD_TEST(suite, test_shipowner_goes_to_same_faction_after_leave);
-  SUITE_ADD_TEST(suite, test_shipowner_goes_to_empty_unit_after_leave);
-  return suite;
+    CuSuite *suite = CuSuiteNew();
+    SUITE_ADD_TEST(suite, test_register_ship);
+    SUITE_ADD_TEST(suite, test_ship_set_owner);
+    SUITE_ADD_TEST(suite, test_shipowner_resets_when_empty);
+    SUITE_ADD_TEST(suite, test_shipowner_goes_to_next_when_empty);
+    SUITE_ADD_TEST(suite, test_shipowner_goes_to_other_when_empty);
+    SUITE_ADD_TEST(suite, test_shipowner_goes_to_same_faction_when_empty);
+    SUITE_ADD_TEST(suite, test_shipowner_goes_to_next_after_leave);
+    SUITE_ADD_TEST(suite, test_shipowner_goes_to_other_after_leave);
+    SUITE_ADD_TEST(suite, test_shipowner_goes_to_same_faction_after_leave);
+    SUITE_ADD_TEST(suite, test_shipowner_goes_to_empty_unit_after_leave);
+    return suite;
 }
diff --git a/src/kernel/skills.c b/src/kernel/skills.c
index cb865e740..3fbd9db7d 100644
--- a/src/kernel/skills.c
+++ b/src/kernel/skills.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -43,213 +43,214 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 /** skillmod attribut **/
 static void init_skillmod(attrib * a)
 {
-  a->data.v = calloc(sizeof(skillmod_data), 1);
+    a->data.v = calloc(sizeof(skillmod_data), 1);
 }
 
 static void finalize_skillmod(attrib * a)
 {
-  free(a->data.v);
+    free(a->data.v);
 }
 
 /** temporary skill modification (NOT SAVED!). */
 attrib_type at_skillmod = {
-  "skillmod",
-  init_skillmod,
-  finalize_skillmod,
-  NULL,
-  NULL,                         /* can't write function pointers */
-  NULL,                         /* can't read function pointers */
-  ATF_PRESERVE
+    "skillmod",
+    init_skillmod,
+    finalize_skillmod,
+    NULL,
+    NULL,                         /* can't write function pointers */
+    NULL,                         /* can't read function pointers */
+    ATF_PRESERVE
 };
 
 attrib *make_skillmod(skill_t sk, unsigned int flags, skillmod_fun special,
-  double multiplier, int bonus)
+    double multiplier, int bonus)
 {
-  attrib *a = a_new(&at_skillmod);
-  skillmod_data *smd = (skillmod_data *) a->data.v;
+    attrib *a = a_new(&at_skillmod);
+    skillmod_data *smd = (skillmod_data *)a->data.v;
 
-  smd->skill = sk;
-  smd->special = special;
-  smd->bonus = bonus;
-  smd->multiplier = multiplier;
-  smd->flags = flags;
+    smd->skill = sk;
+    smd->special = special;
+    smd->bonus = bonus;
+    smd->multiplier = multiplier;
+    smd->flags = flags;
 
-  return a;
+    return a;
 }
 
 int
 skillmod(const attrib * a, const unit * u, const region * r, skill_t sk,
-  int value, int flags)
+int value, int flags)
 {
-  for (a = a_find((attrib *) a, &at_skillmod); a && a->type == &at_skillmod;
-    a = a->next) {
-    skillmod_data *smd = (skillmod_data *) a->data.v;
-    if (smd->skill != NOSKILL && smd->skill != sk)
-      continue;
-    if (flags != SMF_ALWAYS && (smd->flags & flags) == 0)
-      continue;
-    if (smd->special) {
-      value = smd->special(u, r, sk, value);
-      if (value < 0)
-        return value;           /* pass errors back to caller */
+    for (a = a_find((attrib *)a, &at_skillmod); a && a->type == &at_skillmod;
+        a = a->next) {
+        skillmod_data *smd = (skillmod_data *)a->data.v;
+        if (smd->skill != NOSKILL && smd->skill != sk)
+            continue;
+        if (flags != SMF_ALWAYS && (smd->flags & flags) == 0)
+            continue;
+        if (smd->special) {
+            value = smd->special(u, r, sk, value);
+            if (value < 0)
+                return value;           /* pass errors back to caller */
+        }
+        if (smd->multiplier)
+            value = (int)(value * smd->multiplier);
+        value += smd->bonus;
     }
-    if (smd->multiplier)
-      value = (int)(value * smd->multiplier);
-    value += smd->bonus;
-  }
-  return value;
+    return value;
 }
 
 int skill_mod(const race * rc, skill_t sk, const struct terrain_type *terrain)
 {
-  int result = 0;
+    int result = 0;
 
-  result = rc->bonus[sk];
+    result = rc->bonus[sk];
 
-  if (rc == get_race(RC_DWARF)) {
-    if (sk == SK_TACTICS) {
-      if (terrain == newterrain(T_MOUNTAIN) || fval(terrain, ARCTIC_REGION))
-        ++result;
+    if (rc == get_race(RC_DWARF)) {
+        if (sk == SK_TACTICS) {
+            if (terrain == newterrain(T_MOUNTAIN) || fval(terrain, ARCTIC_REGION))
+                ++result;
+        }
+    }
+    else if (rc == get_race(RC_INSECT)) {
+        if (terrain == newterrain(T_MOUNTAIN) || fval(terrain, ARCTIC_REGION))
+            --result;
+        else if (terrain == newterrain(T_DESERT) || terrain == newterrain(T_SWAMP))
+            ++result;
     }
-  }
-  else if (rc == get_race(RC_INSECT)) {
-    if (terrain == newterrain(T_MOUNTAIN) || fval(terrain, ARCTIC_REGION))
-      --result;
-    else if (terrain == newterrain(T_DESERT) || terrain == newterrain(T_SWAMP))
-      ++result;
-  }
 
-  return result;
+    return result;
 }
 
 #define RCMODMAXHASH 31
 #ifdef FASTER_SKILLMOD
 static struct skillmods {
-  struct skillmods *next;
-  const struct race *race;
-  struct modifiers {
-    int value[MAXSKILLS];
-  } mod[MAXTERRAINS];
+    struct skillmods *next;
+    const struct race *race;
+    struct modifiers {
+        int value[MAXSKILLS];
+    } mod[MAXTERRAINS];
 } *modhash[RCMODMAXHASH];
 
 static struct skillmods *init_skills(const race * rc)
 {
-  terrain_t t;
-  struct skillmods *mods =
-    (struct skillmods *)calloc(1, sizeof(struct skillmods));
-  mods->race = rc;
+    terrain_t t;
+    struct skillmods *mods =
+        (struct skillmods *)calloc(1, sizeof(struct skillmods));
+    mods->race = rc;
 
-  for (t = 0; t != MAXTERRAINS; ++t) {
-    skill_t sk;
-    for (sk = 0; sk != MAXSKILLS; ++sk) {
-      mods->mod[t].value[sk] = skill_mod(rc, sk, newterrain(t));
+    for (t = 0; t != MAXTERRAINS; ++t) {
+        skill_t sk;
+        for (sk = 0; sk != MAXSKILLS; ++sk) {
+            mods->mod[t].value[sk] = skill_mod(rc, sk, newterrain(t));
+        }
     }
-  }
-  return mods;
+    return mods;
 }
 #endif
 
 int rc_skillmod(const struct race *rc, const region * r, skill_t sk)
 {
-  int mods = 0;
+    int mods = 0;
 
-  if (!skill_enabled(sk)) {
-    return 0;
-  }
-#ifdef FASTER_SKILLMOD
-  unsigned int index = hashstring(rc->_name) % RCMODMAXHASH;
-  struct skillmods **imods = &modhash[index];
-  while (*imods && (*imods)->race != rc) {
-    imods = &(*imods)->next;
-  }
-  if (*imods == NULL) {
-    *imods = init_skills(rc);
-  }
-  mods = (*imods)->mod[rterrain(r)].value[sk];
-#else
-  if (r) {
-    mods = skill_mod(rc, sk, r->terrain);
-  }
-#endif
-  if (rc == get_race(RC_ELF) && r && r_isforest(r)) {
-    if (sk == SK_PERCEPTION || sk == SK_STEALTH) {
-      ++mods;
-    } else if (sk == SK_TACTICS) {
-      mods += 2;
+    if (!skill_enabled(sk)) {
+        return 0;
     }
-  }
-  return mods;
+#ifdef FASTER_SKILLMOD
+    unsigned int index = hashstring(rc->_name) % RCMODMAXHASH;
+    struct skillmods **imods = &modhash[index];
+    while (*imods && (*imods)->race != rc) {
+        imods = &(*imods)->next;
+    }
+    if (*imods == NULL) {
+        *imods = init_skills(rc);
+    }
+    mods = (*imods)->mod[rterrain(r)].value[sk];
+#else
+    if (r) {
+        mods = skill_mod(rc, sk, r->terrain);
+    }
+#endif
+    if (rc == get_race(RC_ELF) && r && r_isforest(r)) {
+        if (sk == SK_PERCEPTION || sk == SK_STEALTH) {
+            ++mods;
+        }
+        else if (sk == SK_TACTICS) {
+            mods += 2;
+        }
+    }
+    return mods;
 }
 
 int level_days(int level)
 {
-  return 30 * ((level + 1) * level / 2);
+    return 30 * ((level + 1) * level / 2);
 }
 
 int level(int days)
 {
-  int i;
-  static int ldays[64];
-  static bool init = false;
-  if (!init) {
-    init = true;
+    int i;
+    static int ldays[64];
+    static bool init = false;
+    if (!init) {
+        init = true;
+        for (i = 0; i != 64; ++i)
+            ldays[i] = level_days(i + 1);
+    }
     for (i = 0; i != 64; ++i)
-      ldays[i] = level_days(i + 1);
-  }
-  for (i = 0; i != 64; ++i)
-    if (ldays[i] > days)
-      return i;
-  return i;
+        if (ldays[i] > days)
+            return i;
+    return i;
 }
 
 void sk_set(skill * sv, int level)
 {
-  assert(level != 0);
-  sv->weeks = (unsigned char)skill_weeks(level);
-  sv->level = (unsigned char)level;
+    assert(level != 0);
+    sv->weeks = (unsigned char)skill_weeks(level);
+    sv->level = (unsigned char)level;
 }
 
 static int rule_random_progress(void)
 {
-  return get_param_int(global.parameters, "study.random_progress", 1);
+    return get_param_int(global.parameters, "study.random_progress", 1);
 }
 
 int skill_weeks(int level)
 /* how many weeks must i study to get from level to level+1 */
 {
-  if (rule_random_progress()) {
-    int coins = 2 * level;
-    int heads = 1;
-    while (coins--) {
-      heads += rng_int() % 2;
+    if (rule_random_progress()) {
+        int coins = 2 * level;
+        int heads = 1;
+        while (coins--) {
+            heads += rng_int() % 2;
+        }
+        return heads;
     }
-    return heads;
-  }
-  return level + 1;
+    return level + 1;
 }
 
 void reduce_skill(unit * u, skill * sv, unsigned int weeks)
 {
-  sv->weeks += weeks;
-  while (sv->level > 0 && sv->level * 2 + 1 < sv->weeks) {
-    sv->weeks -= sv->level;
-    --sv->level;
-  }
-  if (sv->level == 0) {
-    /* reroll */
-    sv->weeks = (unsigned char)skill_weeks(sv->level);
-  }
+    sv->weeks += weeks;
+    while (sv->level > 0 && sv->level * 2 + 1 < sv->weeks) {
+        sv->weeks -= sv->level;
+        --sv->level;
+    }
+    if (sv->level == 0) {
+        /* reroll */
+        sv->weeks = (unsigned char)skill_weeks(sv->level);
+    }
 }
 
 int skill_compare(const skill * sk, const skill * sc)
 {
-  if (sk->level > sc->level)
-    return 1;
-  if (sk->level < sc->level)
-    return -1;
-  if (sk->weeks < sc->weeks)
-    return 1;
-  if (sk->weeks > sc->weeks)
-    return -1;
-  return 0;
+    if (sk->level > sc->level)
+        return 1;
+    if (sk->level < sc->level)
+        return -1;
+    if (sk->weeks < sc->weeks)
+        return 1;
+    if (sk->weeks > sc->weeks)
+        return -1;
+    return 0;
 }
diff --git a/src/kernel/skills.h b/src/kernel/skills.h
index 5d8b3477f..a7f4e99f9 100644
--- a/src/kernel/skills.h
+++ b/src/kernel/skills.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -19,52 +19,52 @@
 extern "C" {
 #endif
 
-/* skillmod_data::flags -- wann gilt der modifier? */
+    /* skillmod_data::flags -- wann gilt der modifier? */
 #define SMF_ALWAYS     (1<<0)   /* immer */
 #define SMF_PRODUCTION (1<<1)   /* f�r Produktion - am geb�ude, an der einheit */
 #define SMF_RIDING     (1<<2)   /* Bonus f�r berittene - an der rasse */
 
-  typedef struct skill {
+    typedef struct skill {
 #ifdef LOMEM
-    int id:8;
-    unsigned int level:8;
-    unsigned int weeks:8;
-    unsigned int old:8;
+        int id:8;
+        unsigned int level:8;
+        unsigned int weeks:8;
+        unsigned int old:8;
 #else
-    int id;
-    unsigned int level;
-    unsigned int weeks;
-    unsigned int old;
+        int id;
+        unsigned int level;
+        unsigned int weeks;
+        unsigned int old;
 #endif
-  } skill;
+    } skill;
 
-  typedef int (*skillmod_fun) (const struct unit *, const struct region *,
-    skill_t, int);
-  typedef struct skillmod_data {
-    skill_t skill;
-    skillmod_fun special;
-    double multiplier;
-    int number;
-    int bonus;
-    int flags;
-  } skillmod_data;
-  extern struct attrib_type at_skillmod;
-  extern int rc_skillmod(const struct race *rc, const struct region *r,
-    skill_t sk);
-  extern int skillmod(const struct attrib *a, const struct unit *u,
-    const struct region *r, skill_t sk, int value, int flags);
-  extern struct attrib *make_skillmod(skill_t sk, unsigned int flags,
-    skillmod_fun special, double multiplier, int bonus);
+    typedef int(*skillmod_fun) (const struct unit *, const struct region *,
+        skill_t, int);
+    typedef struct skillmod_data {
+        skill_t skill;
+        skillmod_fun special;
+        double multiplier;
+        int number;
+        int bonus;
+        int flags;
+    } skillmod_data;
+    extern struct attrib_type at_skillmod;
+    extern int rc_skillmod(const struct race *rc, const struct region *r,
+        skill_t sk);
+    extern int skillmod(const struct attrib *a, const struct unit *u,
+        const struct region *r, skill_t sk, int value, int flags);
+    extern struct attrib *make_skillmod(skill_t sk, unsigned int flags,
+        skillmod_fun special, double multiplier, int bonus);
 
-  extern int level_days(int level);
-  extern int level(int days);
+    extern int level_days(int level);
+    extern int level(int days);
 
 #define skill_level(level) (level)
-  extern void reduce_skill(struct unit *u, skill * sv, unsigned int change);
-  extern int skill_weeks(int level);
-  extern int skill_compare(const skill * sk, const skill * sc);
+    extern void reduce_skill(struct unit *u, skill * sv, unsigned int change);
+    extern int skill_weeks(int level);
+    extern int skill_compare(const skill * sk, const skill * sc);
 
-  extern void sk_set(skill * sv, int level);
+    extern void sk_set(skill * sv, int level);
 
 #ifdef __cplusplus
 }
diff --git a/src/kernel/spell.c b/src/kernel/spell.c
index 2af5ad16f..e9b38f99d 100644
--- a/src/kernel/spell.c
+++ b/src/kernel/spell.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -37,96 +37,97 @@ static critbit_tree cb_spells;
 quicklist * spells;
 
 void free_spells(void) {
-  cb_clear(&cb_spells);
-  ql_free(spells);
-  spells = 0;
+    cb_clear(&cb_spells);
+    ql_free(spells);
+    spells = 0;
 }
 
 void add_spell(struct quicklist **slistp, spell * sp)
 {
-  if (!ql_set_insert(slistp, sp)) {
-    log_error("add_spell: the list already contains the spell '%s'.\n", sp->sname);
-  }
+    if (!ql_set_insert(slistp, sp)) {
+        log_error("add_spell: the list already contains the spell '%s'.\n", sp->sname);
+    }
 }
 
 spell * create_spell(const char * name, unsigned int id)
 {
-  spell * sp;
-  char buffer[64];
-  size_t len = strlen(name);
+    spell * sp;
+    char buffer[64];
+    size_t len = strlen(name);
 
-  assert(len+sizeof(sp)<sizeof(buffer));
+    assert(len + sizeof(sp) < sizeof(buffer));
 
-  if (cb_find_str(&cb_spells, name)) {
-    log_error("create_spell: duplicate name '%s'\n", name);
+    if (cb_find_str(&cb_spells, name)) {
+        log_error("create_spell: duplicate name '%s'\n", name);
+        return 0;
+    }
+    sp = (spell *)calloc(1, sizeof(spell));
+    len = cb_new_kv(name, len, &sp, sizeof(sp), buffer);
+    if (cb_insert(&cb_spells, buffer, len)) {
+        sp->id = id ? id : hashstring(name);
+        sp->sname = _strdup(name);
+        add_spell(&spells, sp);
+        return sp;
+    }
+    free(sp);
     return 0;
-  }
-  sp = (spell *) calloc(1, sizeof(spell));
-  len = cb_new_kv(name, len, &sp, sizeof(sp), buffer);
-  if (cb_insert(&cb_spells, buffer, len)) {
-    sp->id = id ? id : hashstring(name);
-    sp->sname = _strdup(name);
-    add_spell(&spells, sp);
-    return sp;
-  }
-  free(sp);
-  return 0;
 }
 
 static const char *sp_aliases[][2] = {
-  {"gwyrrdfamiliar", "summon_familiar"},
-  {"illaunfamiliar", "summon_familiar"},
-  {"draigfamiliar", "summon_familiar"},
-  {"commonfamiliar", "summon_familiar"},
-  {NULL, NULL},
+    { "gwyrrdfamiliar", "summon_familiar" },
+    { "illaunfamiliar", "summon_familiar" },
+    { "draigfamiliar", "summon_familiar" },
+    { "commonfamiliar", "summon_familiar" },
+    { NULL, NULL },
 };
 
 static const char *sp_alias(const char *zname)
 {
-  int i;
-  for (i = 0; sp_aliases[i][0]; ++i) {
-    if (strcmp(sp_aliases[i][0], zname) == 0)
-      return sp_aliases[i][1];
-  }
-  return zname;
+    int i;
+    for (i = 0; sp_aliases[i][0]; ++i) {
+        if (strcmp(sp_aliases[i][0], zname) == 0)
+            return sp_aliases[i][1];
+    }
+    return zname;
 }
 
 spell *find_spell(const char *name)
 {
-  const char * match;
-  spell * sp = 0;
-  const char * alias = sp_alias(name);
+    const char * match;
+    spell * sp = 0;
+    const char * alias = sp_alias(name);
 
-  match = cb_find_str(&cb_spells, alias);
-  if (match) {
-    cb_get_kv(match, &sp, sizeof(sp));
-  } else {
-    log_warning("find_spell: could not find spell '%s'\n", name);
-  }
-  return sp;
+    match = cb_find_str(&cb_spells, alias);
+    if (match) {
+        cb_get_kv(match, &sp, sizeof(sp));
+    }
+    else {
+        log_warning("find_spell: could not find spell '%s'\n", name);
+    }
+    return sp;
 }
 
 spell *find_spellbyid(unsigned int id)
 {
-  quicklist *ql;
-  int qi;
+    quicklist *ql;
+    int qi;
 
-  if (id == 0)
+    if (id == 0)
+        return NULL;
+    for (qi = 0, ql = spells; ql; ql_advance(&ql, &qi, 1)) {
+        spell *sp = (spell *)ql_get(ql, qi);
+        if (sp->id == id) {
+            return sp;
+        }
+    }
+    for (qi = 0, ql = spells; ql; ql_advance(&ql, &qi, 1)) {
+        spell *sp = (spell *)ql_get(ql, qi);
+        unsigned int hashid = hashstring(sp->sname);
+        if (hashid == id) {
+            return sp;
+        }
+    }
+
+    log_warning("cannot find spell by id: %u\n", id);
     return NULL;
-  for (qi = 0, ql = spells; ql; ql_advance(&ql, &qi, 1)) {
-    spell *sp = (spell *) ql_get(ql, qi);
-    if (sp->id == id) {
-      return sp;
-    }
-  }
-  for (qi = 0, ql = spells; ql; ql_advance(&ql, &qi, 1)) {
-    spell *sp = (spell *) ql_get(ql, qi);
-    unsigned int hashid = hashstring(sp->sname);
-    if (hashid == id) {
-      return sp;
-    }
-  }
-
-  log_warning("cannot find spell by id: %u\n", id);
-  return NULL;
 }
diff --git a/src/kernel/spell.h b/src/kernel/spell.h
index 7d10df60b..4ab8bb873 100644
--- a/src/kernel/spell.h
+++ b/src/kernel/spell.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -30,36 +30,36 @@ extern "C" {
     struct quicklist;
     struct attrib_type;
 
-  typedef int (*spell_f)(struct castorder * co);
-  typedef void(*fumble_f)(const struct castorder * co);
+    typedef int(*spell_f)(struct castorder * co);
+    typedef void(*fumble_f)(const struct castorder * co);
 
-  typedef struct spell {
-    unsigned int id;
-    char *sname;
-    char *syntax;
-    char *parameter;
-    int sptyp;
-    int rank;                   /* Reihenfolge der Zauber */
-    struct spell_component *components;
-    spell_f cast;
-    fumble_f fumble;
-  } spell;
+    typedef struct spell {
+        unsigned int id;
+        char *sname;
+        char *syntax;
+        char *parameter;
+        int sptyp;
+        int rank;                   /* Reihenfolge der Zauber */
+        struct spell_component *components;
+        spell_f cast;
+        fumble_f fumble;
+    } spell;
 
-  int use_item_power(struct region *r, struct unit *u);
-  int use_item_regeneration(struct region *r, struct unit *u);
-  void showspells(struct region *r, struct unit *u);
-  int sp_antimagiczone(struct castorder *co);
+    int use_item_power(struct region *r, struct unit *u);
+    int use_item_regeneration(struct region *r, struct unit *u);
+    void showspells(struct region *r, struct unit *u);
+    int sp_antimagiczone(struct castorder *co);
 
-  extern struct spell * create_spell(const char * name, unsigned int id);
-  extern struct spell * find_spell(const char *name);
-  extern struct spell * find_spellbyid(unsigned int i);
-  extern void add_spell(struct quicklist **slistp, spell * sp);
-  extern void free_spells(void);
+    extern struct spell * create_spell(const char * name, unsigned int id);
+    extern struct spell * find_spell(const char *name);
+    extern struct spell * find_spellbyid(unsigned int i);
+    extern void add_spell(struct quicklist **slistp, spell * sp);
+    extern void free_spells(void);
 
-  /** globals **/
-  extern struct attrib_type at_unitdissolve;
-  extern struct attrib_type at_wdwpyramid;
-  extern struct quicklist * spells;
+    /** globals **/
+    extern struct attrib_type at_unitdissolve;
+    extern struct attrib_type at_wdwpyramid;
+    extern struct quicklist * spells;
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/kernel/spell.test.c b/src/kernel/spell.test.c
index 7a10edd21..becc93d6f 100644
--- a/src/kernel/spell.test.c
+++ b/src/kernel/spell.test.c
@@ -10,46 +10,46 @@
 
 static void test_create_spell(CuTest * tc)
 {
-  spell * sp;
+    spell * sp;
 
-  test_cleanup();
-  CuAssertPtrEquals(tc, 0, spells);
-  CuAssertPtrEquals(tc, 0, find_spell("testspell"));
+    test_cleanup();
+    CuAssertPtrEquals(tc, 0, spells);
+    CuAssertPtrEquals(tc, 0, find_spell("testspell"));
 
-  sp = create_spell("testspell", 0);
-  CuAssertPtrEquals(tc, sp, find_spell("testspell"));
-  CuAssertPtrNotNull(tc, spells);
+    sp = create_spell("testspell", 0);
+    CuAssertPtrEquals(tc, sp, find_spell("testspell"));
+    CuAssertPtrNotNull(tc, spells);
 }
 
 static void test_create_duplicate_spell(CuTest * tc)
 {
-  spell *sp;
+    spell *sp;
 
-  test_cleanup();
-  CuAssertPtrEquals(tc, 0, find_spell("testspell"));
+    test_cleanup();
+    CuAssertPtrEquals(tc, 0, find_spell("testspell"));
 
-  sp = create_spell("testspell", 0);
-  CuAssertPtrEquals(tc, 0, create_spell("testspell", 0));
-  CuAssertPtrEquals(tc, sp, find_spell("testspell"));
+    sp = create_spell("testspell", 0);
+    CuAssertPtrEquals(tc, 0, create_spell("testspell", 0));
+    CuAssertPtrEquals(tc, sp, find_spell("testspell"));
 }
 
 static void test_create_spell_with_id(CuTest * tc)
 {
-  spell *sp;
+    spell *sp;
 
-  test_cleanup();
-  CuAssertPtrEquals(tc, 0, find_spellbyid(42));
-  sp = create_spell("testspell", 42);
-  CuAssertPtrEquals(tc, sp, find_spellbyid(42));
-  CuAssertPtrEquals(tc, 0, create_spell("testspell", 47));
-  CuAssertPtrEquals(tc, 0, find_spellbyid(47));
+    test_cleanup();
+    CuAssertPtrEquals(tc, 0, find_spellbyid(42));
+    sp = create_spell("testspell", 42);
+    CuAssertPtrEquals(tc, sp, find_spellbyid(42));
+    CuAssertPtrEquals(tc, 0, create_spell("testspell", 47));
+    CuAssertPtrEquals(tc, 0, find_spellbyid(47));
 }
 
 CuSuite *get_spell_suite(void)
 {
-  CuSuite *suite = CuSuiteNew();
-  SUITE_ADD_TEST(suite, test_create_spell);
-  SUITE_ADD_TEST(suite, test_create_duplicate_spell);
-  SUITE_ADD_TEST(suite, test_create_spell_with_id);
-  return suite;
+    CuSuite *suite = CuSuiteNew();
+    SUITE_ADD_TEST(suite, test_create_spell);
+    SUITE_ADD_TEST(suite, test_create_duplicate_spell);
+    SUITE_ADD_TEST(suite, test_create_spell_with_id);
+    return suite;
 }
diff --git a/src/kernel/spellbook.c b/src/kernel/spellbook.c
index 6e31f2a79..96410170b 100644
--- a/src/kernel/spellbook.c
+++ b/src/kernel/spellbook.c
@@ -12,70 +12,70 @@
 
 spellbook * create_spellbook(const char * name)
 {
-  spellbook *result = (spellbook *)malloc(sizeof(spellbook));
-  result->name = name ? _strdup(name) : 0;
-  result->spells = 0;
-  return result;
+    spellbook *result = (spellbook *)malloc(sizeof(spellbook));
+    result->name = name ? _strdup(name) : 0;
+    result->spells = 0;
+    return result;
 }
 
 void spellbook_add(spellbook *sb, struct spell * sp, int level)
 {
-  spellbook_entry * sbe;
+    spellbook_entry * sbe;
 
-  assert(sb && sp && level>0);
+    assert(sb && sp && level > 0);
 #ifndef NDEBUG
-  if (spellbook_get(sb, sp)) {
-    log_error("duplicate spell in spellbook '%s': '%s'\n", sb->name, sp->sname);
-  }
+    if (spellbook_get(sb, sp)) {
+        log_error("duplicate spell in spellbook '%s': '%s'\n", sb->name, sp->sname);
+    }
 #endif  
-  sbe = (spellbook_entry *)malloc(sizeof(spellbook_entry));
-  sbe->sp = sp;
-  sbe->level = level;
-  ql_push(&sb->spells, sbe);
+    sbe = (spellbook_entry *)malloc(sizeof(spellbook_entry));
+    sbe->sp = sp;
+    sbe->level = level;
+    ql_push(&sb->spells, sbe);
 }
 
 void spellbook_clear(spellbook *sb)
 {
-  quicklist *ql;
-  int qi;
+    quicklist *ql;
+    int qi;
 
-  assert(sb);
-  for (qi = 0, ql = sb->spells; ql; ql_advance(&ql, &qi, 1)) {
-    spellbook_entry *sbe = (spellbook_entry *) ql_get(ql, qi);
-    free(sbe);
-  }
-  ql_free(sb->spells);
-  free(sb->name);
-}
-
-int spellbook_foreach(spellbook *sb, int (*callback)(spellbook_entry *, void *), void * data)
-{
-  quicklist *ql;
-  int qi;
-
-  for (qi = 0, ql = sb->spells; ql; ql_advance(&ql, &qi, 1)) {
-    spellbook_entry *sbe = (spellbook_entry *) ql_get(ql, qi);
-    int result = callback(sbe, data);
-    if (result) {
-      return result;
+    assert(sb);
+    for (qi = 0, ql = sb->spells; ql; ql_advance(&ql, &qi, 1)) {
+        spellbook_entry *sbe = (spellbook_entry *)ql_get(ql, qi);
+        free(sbe);
     }
-  }
-  return 0;
+    ql_free(sb->spells);
+    free(sb->name);
 }
 
-spellbook_entry * spellbook_get(spellbook *sb, const struct spell * sp)
+int spellbook_foreach(spellbook *sb, int(*callback)(spellbook_entry *, void *), void * data)
 {
-  if (sb) {
     quicklist *ql;
     int qi;
 
     for (qi = 0, ql = sb->spells; ql; ql_advance(&ql, &qi, 1)) {
-      spellbook_entry *sbe = (spellbook_entry *) ql_get(ql, qi);
-      if (sp==sbe->sp) {
-        return sbe;
-      }
+        spellbook_entry *sbe = (spellbook_entry *)ql_get(ql, qi);
+        int result = callback(sbe, data);
+        if (result) {
+            return result;
+        }
     }
-  }
-  return 0;
+    return 0;
+}
+
+spellbook_entry * spellbook_get(spellbook *sb, const struct spell * sp)
+{
+    if (sb) {
+        quicklist *ql;
+        int qi;
+
+        for (qi = 0, ql = sb->spells; ql; ql_advance(&ql, &qi, 1)) {
+            spellbook_entry *sbe = (spellbook_entry *)ql_get(ql, qi);
+            if (sp == sbe->sp) {
+                return sbe;
+            }
+        }
+    }
+    return 0;
 }
 
diff --git a/src/kernel/spellbook.h b/src/kernel/spellbook.h
index 94b3eb448..aaabe0994 100644
--- a/src/kernel/spellbook.h
+++ b/src/kernel/spellbook.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2012, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -23,26 +23,26 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-struct spell;
-struct quicklist;
+    struct spell;
+    struct quicklist;
 
-typedef struct spellbook_entry {
-  struct spell * sp;
-  int level;
-} spellbook_entry;
+    typedef struct spellbook_entry {
+        struct spell * sp;
+        int level;
+    } spellbook_entry;
 
-typedef struct spellbook
-{
-  char * name;
-  struct quicklist * spells;
-} spellbook;
+    typedef struct spellbook
+    {
+        char * name;
+        struct quicklist * spells;
+    } spellbook;
 
-spellbook * create_spellbook(const char * name);
+    spellbook * create_spellbook(const char * name);
 
-void spellbook_add(spellbook *sbp, struct spell * sp, int level);
-int spellbook_foreach(spellbook *sb, int (*callback)(spellbook_entry *, void *), void * data);
-void spellbook_clear(spellbook *sb);
-spellbook_entry * spellbook_get(spellbook *sb, const struct spell * sp);
+    void spellbook_add(spellbook *sbp, struct spell * sp, int level);
+    int spellbook_foreach(spellbook *sb, int(*callback)(spellbook_entry *, void *), void * data);
+    void spellbook_clear(spellbook *sb);
+    spellbook_entry * spellbook_get(spellbook *sb, const struct spell * sp);
 
 #ifdef __cplusplus
 }
diff --git a/src/kernel/spellbook.test.c b/src/kernel/spellbook.test.c
index 64514101f..2f78fd87d 100644
--- a/src/kernel/spellbook.test.c
+++ b/src/kernel/spellbook.test.c
@@ -12,53 +12,53 @@
 
 int count_spell_cb(spellbook_entry * sbe, void * ptr)
 {
-  int * counter = (int *)ptr;
-  ++*counter;
-  return 0;
+    int * counter = (int *)ptr;
+    ++*counter;
+    return 0;
 }
 
 void test_named_spellbooks(CuTest * tc)
 {
-  spell *sp;
-  spellbook *sb;
-  spellbook_entry *sbe;
-  int counter = 0;
-  
-  sb = create_spellbook(0);
-  CuAssertPtrNotNull(tc, sb);
-  CuAssertPtrEquals(tc, 0, sb->name);
-  spellbook_clear(sb);
-  free(sb);
+    spell *sp;
+    spellbook *sb;
+    spellbook_entry *sbe;
+    int counter = 0;
 
-  sb = create_spellbook("spells");
-  CuAssertPtrNotNull(tc, sb);
-  CuAssertStrEquals(tc, "spells", sb->name);
+    sb = create_spellbook(0);
+    CuAssertPtrNotNull(tc, sb);
+    CuAssertPtrEquals(tc, 0, sb->name);
+    spellbook_clear(sb);
+    free(sb);
 
-  sp = create_spell("testspell", 0);
-  spellbook_add(sb, sp, 1);
-  CuAssertPtrNotNull(tc, sb->spells);
+    sb = create_spellbook("spells");
+    CuAssertPtrNotNull(tc, sb);
+    CuAssertStrEquals(tc, "spells", sb->name);
 
-  sbe = spellbook_get(sb, sp);
-  CuAssertPtrNotNull(tc, sbe);
-  CuAssertIntEquals(tc, 1, sbe->level);
-  CuAssertPtrEquals(tc, sp, sbe->sp);
+    sp = create_spell("testspell", 0);
+    spellbook_add(sb, sp, 1);
+    CuAssertPtrNotNull(tc, sb->spells);
 
-  spellbook_foreach(sb, count_spell_cb, &counter);
-  CuAssertIntEquals(tc, 1, counter);
+    sbe = spellbook_get(sb, sp);
+    CuAssertPtrNotNull(tc, sbe);
+    CuAssertIntEquals(tc, 1, sbe->level);
+    CuAssertPtrEquals(tc, sp, sbe->sp);
+
+    spellbook_foreach(sb, count_spell_cb, &counter);
+    CuAssertIntEquals(tc, 1, counter);
 
 #ifdef TODO
-  /* try adding the same spell twice. that should fail */
-  spellbook_add(sb, sp, 1);
-  spellbook_foreach(sb, count_spell_cb, &counter);
-  CuAssertIntEquals(tc, 1, counter);
+    /* try adding the same spell twice. that should fail */
+    spellbook_add(sb, sp, 1);
+    spellbook_foreach(sb, count_spell_cb, &counter);
+    CuAssertIntEquals(tc, 1, counter);
 #endif
-  spellbook_clear(sb);
-  free(sb);
+    spellbook_clear(sb);
+    free(sb);
 }
 
 CuSuite *get_spellbook_suite(void)
 {
-  CuSuite *suite = CuSuiteNew();
-  SUITE_ADD_TEST(suite, test_named_spellbooks);
-  return suite;
+    CuSuite *suite = CuSuiteNew();
+    SUITE_ADD_TEST(suite, test_named_spellbooks);
+    return suite;
 }
diff --git a/src/kernel/spellid.h b/src/kernel/spellid.h
index 8b0e7c668..ce324874b 100644
--- a/src/kernel/spellid.h
+++ b/src/kernel/spellid.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
 * +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
 * |                   |  Enno Rehling <enno@eressea.de>
 * | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
diff --git a/src/kernel/teleport.c b/src/kernel/teleport.c
index d0f5db424..d5a5cb154 100644
--- a/src/kernel/teleport.c
+++ b/src/kernel/teleport.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -46,190 +46,190 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 static int real2tp(int rk)
 {
-  /* in C:
-   * -4 / 5 = 0;
-   * +4 / 5 = 0;
-   * !!!!!!!!!!;
-   */
-  return (rk + (TP_DISTANCE * 5000)) / TP_DISTANCE - 5000;
+    /* in C:
+     * -4 / 5 = 0;
+     * +4 / 5 = 0;
+     * !!!!!!!!!!;
+     */
+    return (rk + (TP_DISTANCE * 5000)) / TP_DISTANCE - 5000;
 }
 
 static region *tpregion(const region * r)
 {
-  region *rt =
-    findregion(TE_CENTER_X + real2tp(r->x), TE_CENTER_Y + real2tp(r->y));
-  if (!is_astral(rt))
-    return NULL;
-  return rt;
+    region *rt =
+        findregion(TE_CENTER_X + real2tp(r->x), TE_CENTER_Y + real2tp(r->y));
+    if (!is_astral(rt))
+        return NULL;
+    return rt;
 }
 
 region_list *astralregions(const region * r, bool(*valid) (const region *))
 {
-  region_list *rlist = NULL;
-  int x, y;
+    region_list *rlist = NULL;
+    int x, y;
 
-  assert(is_astral(r));
-  if (!is_astral(r)) {
-    log_error("astralregions was called with a non-astral region.\n");
-    return NULL;
-  }
-  r = r_astral_to_standard(r);
-  if (r == NULL)
-    return NULL;
-
-  for (x = -TP_RADIUS; x <= +TP_RADIUS; ++x) {
-    for (y = -TP_RADIUS; y <= +TP_RADIUS; ++y) {
-      region *rn;
-      int dist = koor_distance(0, 0, x, y);
-      int nx = r->x + x, ny = r->y + y;
-
-      if (dist > TP_RADIUS)
-        continue;
-      pnormalize(&nx, &ny, rplane(r));
-      rn = findregion(nx, ny);
-      if (rn != NULL && (valid == NULL || valid(rn)))
-        add_regionlist(&rlist, rn);
+    assert(is_astral(r));
+    if (!is_astral(r)) {
+        log_error("astralregions was called with a non-astral region.\n");
+        return NULL;
     }
-  }
-  return rlist;
+    r = r_astral_to_standard(r);
+    if (r == NULL)
+        return NULL;
+
+    for (x = -TP_RADIUS; x <= +TP_RADIUS; ++x) {
+        for (y = -TP_RADIUS; y <= +TP_RADIUS; ++y) {
+            region *rn;
+            int dist = koor_distance(0, 0, x, y);
+            int nx = r->x + x, ny = r->y + y;
+
+            if (dist > TP_RADIUS)
+                continue;
+            pnormalize(&nx, &ny, rplane(r));
+            rn = findregion(nx, ny);
+            if (rn != NULL && (valid == NULL || valid(rn)))
+                add_regionlist(&rlist, rn);
+        }
+    }
+    return rlist;
 }
 
 region *r_standard_to_astral(const region * r)
 {
-  if (rplane(r) != get_normalplane())
-    return NULL;
-  return tpregion(r);
+    if (rplane(r) != get_normalplane())
+        return NULL;
+    return tpregion(r);
 }
 
 region *r_astral_to_standard(const region * r)
 {
-  int x, y;
-  region *r2;
+    int x, y;
+    region *r2;
 
-  assert(is_astral(r));
-  x = (r->x - TE_CENTER_X) * TP_DISTANCE;
-  y = (r->y - TE_CENTER_Y) * TP_DISTANCE;
-  pnormalize(&x, &y, get_normalplane());
-  r2 = findregion(x, y);
-  if (r2 == NULL || rplane(r2) != get_normalplane())
-    return NULL;
+    assert(is_astral(r));
+    x = (r->x - TE_CENTER_X) * TP_DISTANCE;
+    y = (r->y - TE_CENTER_Y) * TP_DISTANCE;
+    pnormalize(&x, &y, get_normalplane());
+    r2 = findregion(x, y);
+    if (r2 == NULL || rplane(r2) != get_normalplane())
+        return NULL;
 
-  return r2;
+    return r2;
 }
 
 region_list *all_in_range(const region * r, int n,
-  bool(*valid) (const region *))
+    bool(*valid) (const region *))
 {
-  int x, y;
-  region_list *rlist = NULL;
-  plane *pl = rplane(r);
+    int x, y;
+    region_list *rlist = NULL;
+    plane *pl = rplane(r);
 
-  if (r == NULL)
-    return NULL;
+    if (r == NULL)
+        return NULL;
 
-  for (x = r->x - n; x <= r->x + n; x++) {
-    for (y = r->y - n; y <= r->y + n; y++) {
-      if (koor_distance(r->x, r->y, x, y) <= n) {
-        region *r2;
-        int nx = x, ny = y;
-        pnormalize(&nx, &ny, pl);
-        r2 = findregion(nx, ny);
-        if (r2 != NULL && (valid == NULL || valid(r2)))
-          add_regionlist(&rlist, r2);
-      }
+    for (x = r->x - n; x <= r->x + n; x++) {
+        for (y = r->y - n; y <= r->y + n; y++) {
+            if (koor_distance(r->x, r->y, x, y) <= n) {
+                region *r2;
+                int nx = x, ny = y;
+                pnormalize(&nx, &ny, pl);
+                r2 = findregion(nx, ny);
+                if (r2 != NULL && (valid == NULL || valid(r2)))
+                    add_regionlist(&rlist, r2);
+            }
+        }
     }
-  }
 
-  return rlist;
+    return rlist;
 }
 
 void spawn_braineaters(float chance)
 {
-  region *r;
-  faction *f0 = get_monsters();
-  int next = rng_int() % (int)(chance * 100);
+    region *r;
+    faction *f0 = get_monsters();
+    int next = rng_int() % (int)(chance * 100);
 
-  if (f0 == NULL)
-    return;
+    if (f0 == NULL)
+        return;
 
-  for (r = regions; r; r = r->next) {
-    if (!is_astral(r) || fval(r->terrain, FORBIDDEN_REGION))
-      continue;
+    for (r = regions; r; r = r->next) {
+        if (!is_astral(r) || fval(r->terrain, FORBIDDEN_REGION))
+            continue;
 
-    /* Neues Monster ? */
-    if (next-- == 0) {
-      unit *u =
-        create_unit(r, f0, 1 + rng_int() % 10 + rng_int() % 10,
-        get_race(RC_HIRNTOETER), 0, NULL, NULL);
-      equip_unit(u, get_equipment("monster_braineater"));
+        /* Neues Monster ? */
+        if (next-- == 0) {
+            unit *u =
+                create_unit(r, f0, 1 + rng_int() % 10 + rng_int() % 10,
+                get_race(RC_HIRNTOETER), 0, NULL, NULL);
+            equip_unit(u, get_equipment("monster_braineater"));
 
-      next = rng_int() % (int)(chance * 100);
+            next = rng_int() % (int)(chance * 100);
+        }
     }
-  }
 }
 
 plane *get_normalplane(void)
 {
-  return NULL;
+    return NULL;
 }
 
 bool is_astral(const region * r)
 {
-  plane *pl = get_astralplane();
-  return (pl && rplane(r) == pl);
+    plane *pl = get_astralplane();
+    return (pl && rplane(r) == pl);
 }
 
 plane *get_astralplane(void)
 {
-  static plane *astralspace;
-  static int rule_astralplane = -1;
-  static int gamecookie = -1;
-  if (rule_astralplane < 0) {
-    rule_astralplane =
-      get_param_int(global.parameters, "modules.astralspace", 1);
-  }
-  if (!rule_astralplane) {
-    return NULL;
-  }
-  if (gamecookie != global.cookie) {
-    astralspace = getplanebyname("Astralraum");
-    gamecookie = global.cookie;
-  }
+    static plane *astralspace;
+    static int rule_astralplane = -1;
+    static int gamecookie = -1;
+    if (rule_astralplane < 0) {
+        rule_astralplane =
+            get_param_int(global.parameters, "modules.astralspace", 1);
+    }
+    if (!rule_astralplane) {
+        return NULL;
+    }
+    if (gamecookie != global.cookie) {
+        astralspace = getplanebyname("Astralraum");
+        gamecookie = global.cookie;
+    }
 
-  if (astralspace == NULL) {
-    astralspace = create_new_plane(1, "Astralraum",
-      TE_CENTER_X - 500, TE_CENTER_X + 500,
-      TE_CENTER_Y - 500, TE_CENTER_Y + 500, 0);
-  }
-  return astralspace;
+    if (astralspace == NULL) {
+        astralspace = create_new_plane(1, "Astralraum",
+            TE_CENTER_X - 500, TE_CENTER_X + 500,
+            TE_CENTER_Y - 500, TE_CENTER_Y + 500, 0);
+    }
+    return astralspace;
 }
 
 void create_teleport_plane(void)
 {
-  region *r;
-  plane *hplane = get_homeplane();
-  plane *aplane = get_astralplane();
+    region *r;
+    plane *hplane = get_homeplane();
+    plane *aplane = get_astralplane();
 
-  const terrain_type *fog = get_terrain("fog");
+    const terrain_type *fog = get_terrain("fog");
 
-  for (r = regions; r; r = r->next) {
-    plane *pl = rplane(r);
-    if (pl == hplane) {
-      region *ra = tpregion(r);
+    for (r = regions; r; r = r->next) {
+        plane *pl = rplane(r);
+        if (pl == hplane) {
+            region *ra = tpregion(r);
 
-      if (ra == NULL) {
-        int x = TE_CENTER_X + real2tp(r->x);
-        int y = TE_CENTER_Y + real2tp(r->y);
-        pnormalize(&x, &y, aplane);
+            if (ra == NULL) {
+                int x = TE_CENTER_X + real2tp(r->x);
+                int y = TE_CENTER_Y + real2tp(r->y);
+                pnormalize(&x, &y, aplane);
 
-        ra = new_region(x, y, aplane, 0);
-        terraform_region(ra, fog);
-      }
+                ra = new_region(x, y, aplane, 0);
+                terraform_region(ra, fog);
+            }
+        }
     }
-  }
 }
 
 bool inhabitable(const region * r)
 {
-  return fval(r->terrain, LAND_REGION);
+    return fval(r->terrain, LAND_REGION);
 }
diff --git a/src/kernel/teleport.h b/src/kernel/teleport.h
index 75be6b5d1..e91329b9e 100644
--- a/src/kernel/teleport.h
+++ b/src/kernel/teleport.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,20 +22,20 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  struct region *r_standard_to_astral(const struct region *r);
-  struct region *r_astral_to_standard(const struct region *);
-  extern struct region_list *astralregions(const struct region *rastral,
-    bool(*valid) (const struct region *));
-  extern struct region_list *all_in_range(const struct region *r, int n,
-    bool(*valid) (const struct region *));
-  extern bool inhabitable(const struct region *r);
-  extern bool is_astral(const struct region *r);
-  extern struct plane *get_astralplane(void);
-  extern struct plane *get_normalplane(void);
+    struct region *r_standard_to_astral(const struct region *r);
+    struct region *r_astral_to_standard(const struct region *);
+    extern struct region_list *astralregions(const struct region *rastral,
+        bool(*valid) (const struct region *));
+    extern struct region_list *all_in_range(const struct region *r, int n,
+        bool(*valid) (const struct region *));
+    extern bool inhabitable(const struct region *r);
+    extern bool is_astral(const struct region *r);
+    extern struct plane *get_astralplane(void);
+    extern struct plane *get_normalplane(void);
 
-  void create_teleport_plane(void);
-  void set_teleport_plane_regiontypes(void);
-  void spawn_braineaters(float chance);
+    void create_teleport_plane(void);
+    void set_teleport_plane_regiontypes(void);
+    void spawn_braineaters(float chance);
 
 #ifdef __cplusplus
 }
diff --git a/src/kernel/terrain.c b/src/kernel/terrain.c
index 076e64da6..b6cf51c0e 100644
--- a/src/kernel/terrain.c
+++ b/src/kernel/terrain.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -38,40 +38,40 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #define MAXTERRAINS 20
 
 const char *terraindata[MAXTERRAINS] = {
-  "ocean",
-  "plain",
-  "swamp",
-  "desert",
-  "highland",
-  "mountain",
-  "glacier",
-  "firewall",
-  NULL,                         /* dungeon module */
-  NULL,                         /* former grassland */
-  "fog",
-  "thickfog",
-  "volcano",
-  "activevolcano",
-  "iceberg_sleep",
-  "iceberg",
+    "ocean",
+    "plain",
+    "swamp",
+    "desert",
+    "highland",
+    "mountain",
+    "glacier",
+    "firewall",
+    NULL,                         /* dungeon module */
+    NULL,                         /* former grassland */
+    "fog",
+    "thickfog",
+    "volcano",
+    "activevolcano",
+    "iceberg_sleep",
+    "iceberg",
 
-  NULL,                         /* museum module */
-  NULL,                         /* museum module */
-  NULL,                         /* former magicstorm */
-  NULL                          /* museum module */
+    NULL,                         /* museum module */
+    NULL,                         /* museum module */
+    NULL,                         /* former magicstorm */
+    NULL                          /* museum module */
 };
 
 static terrain_type *registered_terrains;
 
 void free_terrains(void)
 {
-  while (registered_terrains) {
-    terrain_type * t = registered_terrains;
-    registered_terrains = t->next;
-    free(t->_name);
-    free(t->production);
-    free(t);
-  }
+    while (registered_terrains) {
+        terrain_type * t = registered_terrains;
+        registered_terrains = t->next;
+        free(t->_name);
+        free(t->production);
+        free(t);
+    }
 }
 
 const terrain_type *terrains(void)
@@ -83,7 +83,7 @@ static const char *plain_name(const struct region *r)
 {
     /* TODO: xml defined */
     if (r_isforest(r)) {
-       return "forest";
+        return "forest";
     }
     return r->terrain->_name;
 }
@@ -92,9 +92,9 @@ static terrain_type *terrain_find_i(const char *name)
 {
     terrain_type *terrain;
     for (terrain = registered_terrains; terrain; terrain = terrain->next) {
-      if (strcmp(terrain->_name, name) == 0) {
-          break;
-      }
+        if (strcmp(terrain->_name, name) == 0) {
+            break;
+        }
     }
     return terrain;
 }
@@ -108,7 +108,7 @@ terrain_type * get_or_create_terrain(const char *name) {
     if (!terrain) {
         terrain = (terrain_type *)calloc(sizeof(terrain_type), 1);
         if (terrain) {
-            terrain->_name = _strdup(name); 
+            terrain->_name = _strdup(name);
             terrain->next = registered_terrains;
             registered_terrains = terrain;
             if (strcmp("plain", name) == 0) {
@@ -117,66 +117,67 @@ terrain_type * get_or_create_terrain(const char *name) {
             }
         }
     }
-    return terrain; 
+    return terrain;
 }
 
 static const terrain_type *newterrains[MAXTERRAINS];
 
 const struct terrain_type *newterrain(terrain_t t)
 {
-  if (t == NOTERRAIN)
-    return NULL;
-  assert(t >= 0);
-  assert(t < MAXTERRAINS);
-  return newterrains[t];
+    if (t == NOTERRAIN)
+        return NULL;
+    assert(t >= 0);
+    assert(t < MAXTERRAINS);
+    return newterrains[t];
 }
 
 terrain_t oldterrain(const struct terrain_type * terrain)
 {
-  terrain_t t;
-  if (terrain == NULL)
+    terrain_t t;
+    if (terrain == NULL)
+        return NOTERRAIN;
+    for (t = 0; t != MAXTERRAINS; ++t) {
+        if (newterrains[t] == terrain)
+            return t;
+    }
+    log_warning("%s is not a classic terrain.\n", terrain->_name);
     return NOTERRAIN;
-  for (t = 0; t != MAXTERRAINS; ++t) {
-    if (newterrains[t] == terrain)
-      return t;
-  }
-  log_warning("%s is not a classic terrain.\n", terrain->_name);
-  return NOTERRAIN;
 }
 
 const char *terrain_name(const struct region *r)
 {
-  if (r->attribs) {
-    attrib *a = a_find(r->attribs, &at_racename);
-    if (a) {
-      const char *str = get_racename(a);
-      if (str)
-        return str;
+    if (r->attribs) {
+        attrib *a = a_find(r->attribs, &at_racename);
+        if (a) {
+            const char *str = get_racename(a);
+            if (str)
+                return str;
+        }
     }
-  }
 
-  if (r->terrain->name != NULL) {
-    return r->terrain->name(r);
-  } else if (fval(r->terrain, SEA_REGION)) {
-    if (curse_active(get_curse(r->attribs, ct_find("maelstrom")))) {
-      return "maelstrom";
+    if (r->terrain->name != NULL) {
+        return r->terrain->name(r);
     }
-  }
-  return r->terrain->_name;
+    else if (fval(r->terrain, SEA_REGION)) {
+        if (curse_active(get_curse(r->attribs, ct_find("maelstrom")))) {
+            return "maelstrom";
+        }
+    }
+    return r->terrain->_name;
 }
 
 void init_terrains(void)
 {
-  terrain_t t;
-  for (t = 0; t != MAXTERRAINS; ++t) {
-    const terrain_type *newterrain = newterrains[t];
-    if (newterrain != NULL)
-      continue;
-    if (terraindata[t] != NULL) {
-      newterrain = get_terrain(terraindata[t]);
-      if (newterrain != NULL) {
-        newterrains[t] = newterrain;
-      }
+    terrain_t t;
+    for (t = 0; t != MAXTERRAINS; ++t) {
+        const terrain_type *newterrain = newterrains[t];
+        if (newterrain != NULL)
+            continue;
+        if (terraindata[t] != NULL) {
+            newterrain = get_terrain(terraindata[t]);
+            if (newterrain != NULL) {
+                newterrains[t] = newterrain;
+            }
+        }
     }
-  }
 }
diff --git a/src/kernel/terrain.h b/src/kernel/terrain.h
index 3630a2e7b..ac2808ed4 100644
--- a/src/kernel/terrain.h
+++ b/src/kernel/terrain.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,60 +22,60 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-/* diverse Flags */
-/* Strassen und Geb�ude k�nnen gebaut werden, wenn max_road > 0 */
+    /* diverse Flags */
+    /* Strassen und Geb�ude k�nnen gebaut werden, wenn max_road > 0 */
 #define LAND_REGION      (1<<0) /* Standard-Land-struct region */
 #define SEA_REGION       (1<<1) /* hier braucht man ein Boot */
 #define FOREST_REGION    (1<<2) /* Elfen- und Kampfvorteil durch B�ume */
 #define ARCTIC_REGION    (1<<3) /* Gletscher & co = Keine Insekten! */
 #define CAVALRY_REGION   (1<<4) /* riding in combat is possible */
-/* Achtung: SEA_REGION ist nicht das Gegenteil von LAND_REGION. Die zwei schliessen sich nichtmal aus! */
+    /* Achtung: SEA_REGION ist nicht das Gegenteil von LAND_REGION. Die zwei schliessen sich nichtmal aus! */
 #define FORBIDDEN_REGION (1<<5) /* unpassierbare Blockade-struct region */
 #define SAIL_INTO		     (1<<6)     /* man darf hierhin segeln */
 #define FLY_INTO		     (1<<7)     /* man darf hierhin fliegen */
 #define SWIM_INTO		     (1<<8)     /* man darf hierhin schwimmen */
 #define WALK_INTO		     (1<<9)     /* man darf hierhin laufen */
 
-  typedef struct production_rule {
-    char *name;
-    const struct resource_type *rtype;
+    typedef struct production_rule {
+        char *name;
+        const struct resource_type *rtype;
 
-    void (*terraform) (struct production_rule *, const struct region *);
-    void (*update) (struct production_rule *, const struct region *);
-    void (*use) (struct production_rule *, const struct region *, int amount);
-    int (*visible) (const struct production_rule *, int skilllevel);
+        void(*terraform) (struct production_rule *, const struct region *);
+        void(*update) (struct production_rule *, const struct region *);
+        void(*use) (struct production_rule *, const struct region *, int amount);
+        int(*visible) (const struct production_rule *, int skilllevel);
 
-    /* no initialization required */
-    struct production_rule *next;
-  } production_rule;
+        /* no initialization required */
+        struct production_rule *next;
+    } production_rule;
 
-  typedef struct terrain_production {
-    const struct resource_type *type;
-    const char *startlevel;
-    const char *base;
-    const char *divisor;
-    float chance;
-  } terrain_production;
+    typedef struct terrain_production {
+        const struct resource_type *type;
+        const char *startlevel;
+        const char *base;
+        const char *divisor;
+        float chance;
+    } terrain_production;
 
-  typedef struct terrain_type {
-    char *_name;
-    int size;                   /* how many peasants can work? */
-    int flags;
-    short max_road;             /* this many stones make a full road */
-    short distribution;         /* multiplier used for seeding */
-    struct terrain_production *production;
-    const struct item_type **herbs;     /* zero-terminated array of herbs */
-    const char *(*name) (const struct region * r);
-    struct terrain_type *next;
-  } terrain_type;
+    typedef struct terrain_type {
+        char *_name;
+        int size;                   /* how many peasants can work? */
+        int flags;
+        short max_road;             /* this many stones make a full road */
+        short distribution;         /* multiplier used for seeding */
+        struct terrain_production *production;
+        const struct item_type **herbs;     /* zero-terminated array of herbs */
+        const char *(*name) (const struct region * r);
+        struct terrain_type *next;
+    } terrain_type;
 
-  extern terrain_type *get_or_create_terrain(const char *name);
-  extern const terrain_type *terrains(void);
-  extern const terrain_type *get_terrain(const char *name);
-  extern const char *terrain_name(const struct region *r);
+    extern terrain_type *get_or_create_terrain(const char *name);
+    extern const terrain_type *terrains(void);
+    extern const terrain_type *get_terrain(const char *name);
+    extern const char *terrain_name(const struct region *r);
 
-  extern void init_terrains(void);
-  void free_terrains(void);
+    extern void init_terrains(void);
+    void free_terrains(void);
 
 #ifdef __cplusplus
 }
diff --git a/src/kernel/terrainid.h b/src/kernel/terrainid.h
index b7f4119d9..0685a60e9 100644
--- a/src/kernel/terrainid.h
+++ b/src/kernel/terrainid.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  * +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  * |                   |  Enno Rehling <enno@eressea.de>
  * | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
diff --git a/src/kernel/types.h b/src/kernel/types.h
index 7a93c9ff1..e1303a0bc 100644
--- a/src/kernel/types.h
+++ b/src/kernel/types.h
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
                          Katja Zedel <katze@felidae.kn-bremen.de
                          Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/kernel/unit.c b/src/kernel/unit.c
index 348a46437..3f537acd9 100644
--- a/src/kernel/unit.c
+++ b/src/kernel/unit.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
@@ -1218,7 +1218,7 @@ skill *add_skill(unit * u, skill_t id)
     sv->old = 0;
     sv->id = id;
     if (id == SK_MAGIC && u->faction && !fval(u->faction, FFL_NPC)) {
-        assert(u->number<=1);
+        assert(u->number <= 1);
         assert(max_magicians(u->faction) >= u->number);
     }
     return sv;
@@ -1882,7 +1882,8 @@ char *write_unitname(const unit * u, char *buffer, size_t size)
 {
     if (u->name) {
         slprintf(buffer, size, "%s (%s)", u->name, itoa36(u->no));
-    } else {
+    }
+    else {
         const struct locale * lang = u->faction ? u->faction->locale : default_locale;
         const char * name = rc_name_s(u->_race, u->number == 1 ? NAME_SINGULAR : NAME_PLURAL);
         slprintf(buffer, size, "%s (%s)", LOC(lang, name), itoa36(u->no));
diff --git a/src/kernel/unit.h b/src/kernel/unit.h
index 17ae915f3..01ab3e192 100644
--- a/src/kernel/unit.h
+++ b/src/kernel/unit.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -26,9 +26,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  struct skill;
-  struct item;
-  struct sc_mage;
+    struct skill;
+    struct item;
+    struct sc_mage;
 
 #define UFL_DEAD          (1<<0)
 #define UFL_ISNEW         (1<<1)        /* 2 */
@@ -47,7 +47,7 @@ extern "C" {
 #define UFL_WERE          (1<<14)
 #define UFL_ENTER         (1<<15)       /* unit has entered a ship/building and will not leave it */
 
-/* warning: von 512/1024 gewechslet, wegen konflikt mit NEW_FOLLOW */
+    /* warning: von 512/1024 gewechslet, wegen konflikt mit NEW_FOLLOW */
 #define UFL_LOCKED        (1<<16)       /* Einheit kann keine Personen aufnehmen oder weggeben, nicht rekrutieren. */
 #define UFL_FLEEING       (1<<17)       /* unit was in a battle, fleeing. */
 #define UFL_STORM         (1<<19)       /* Kapit�n war in einem Sturm */
@@ -59,199 +59,199 @@ extern "C" {
 #define UFL_ORDERS        (1<<24)       /* Einheit hat Befehle erhalten */
 #define UFL_TAKEALL       (1<<25)       /* Einheit nimmt alle Gegenst�nde an */
 
-/* flags that speed up attribute access: */
+    /* flags that speed up attribute access: */
 #define UFL_STEALTH       (1<<26)
 #define UFL_GUARD         (1<<27)
 #define UFL_GROUP         (1<<28)
 
-/* Flags, die gespeichert werden sollen: */
+    /* Flags, die gespeichert werden sollen: */
 #define UFL_SAVEMASK (UFL_DEFENDER|UFL_MOVED|UFL_NOAID|UFL_ANON_FACTION|UFL_LOCKED|UFL_HUNGER|UFL_TAKEALL|UFL_GUARD|UFL_STEALTH|UFL_GROUP|UFL_HERO)
 
 #define UNIT_MAXSIZE 50000
-  extern int maxheroes(const struct faction *f);
-  extern int countheroes(const struct faction *f);
+    extern int maxheroes(const struct faction *f);
+    extern int countheroes(const struct faction *f);
 
-  typedef struct reservation {
-    struct reservation *next;
-    const struct item_type *type;
-    int value;
-  } reservation;
+    typedef struct reservation {
+        struct reservation *next;
+        const struct item_type *type;
+        int value;
+    } reservation;
 
-  typedef struct unit {
-    struct unit *next;          /* needs to be first entry, for region's unitlist */
-    struct unit *nextF;         /* n�chste Einheit der Partei */
-    struct unit *prevF;         /* vorherige Einheit der Partei */
-    struct region *region;
-    int no;
-    int hp;
-    char *name;
-    char *display;
-    struct faction *faction;
-    struct building *building;
-    struct ship *ship;
-    unsigned short number;
-    short age;
+    typedef struct unit {
+        struct unit *next;          /* needs to be first entry, for region's unitlist */
+        struct unit *nextF;         /* n�chste Einheit der Partei */
+        struct unit *prevF;         /* vorherige Einheit der Partei */
+        struct region *region;
+        int no;
+        int hp;
+        char *name;
+        char *display;
+        struct faction *faction;
+        struct building *building;
+        struct ship *ship;
+        unsigned short number;
+        short age;
 
-    /* skill data */
-    short skill_size;
-    struct skill *skills;
-    struct item *items;
-    reservation *reservations;
+        /* skill data */
+        short skill_size;
+        struct skill *skills;
+        struct item *items;
+        reservation *reservations;
 
-    /* orders */
-    struct order *orders;
-    struct order *thisorder;
-    struct order *old_orders;
+        /* orders */
+        struct order *orders;
+        struct order *thisorder;
+        struct order *old_orders;
 
-    /* race and illusionary race */
-    const struct race *_race;
-    const struct race *irace;
+        /* race and illusionary race */
+        const struct race *_race;
+        const struct race *irace;
 
-    int flags;
-    struct attrib *attribs;
-    status_t status;
-    int n;                      /* enno: attribut? */
-    int wants;                  /* enno: attribut? */
-  } unit;
+        int flags;
+        struct attrib *attribs;
+        status_t status;
+        int n;                      /* enno: attribut? */
+        int wants;                  /* enno: attribut? */
+    } unit;
 
-  extern struct attrib_type at_creator;
-  extern struct attrib_type at_alias;
-  extern struct attrib_type at_siege;
-  extern struct attrib_type at_target;
-  extern struct attrib_type at_potionuser;
-  extern struct attrib_type at_contact;
-  extern struct attrib_type at_effect;
-  extern struct attrib_type at_private;
-  extern struct attrib_type at_showskchange;
+    extern struct attrib_type at_creator;
+    extern struct attrib_type at_alias;
+    extern struct attrib_type at_siege;
+    extern struct attrib_type at_target;
+    extern struct attrib_type at_potionuser;
+    extern struct attrib_type at_contact;
+    extern struct attrib_type at_effect;
+    extern struct attrib_type at_private;
+    extern struct attrib_type at_showskchange;
 
-  int ualias(const struct unit *u);
-  int weight(const struct unit *u);
+    int ualias(const struct unit *u);
+    int weight(const struct unit *u);
 
-  const struct race *u_irace(const struct unit *u);
-  const struct race *u_race(const struct unit *u);
-  void u_setrace(struct unit *u, const struct race *);
-  struct building *usiege(const struct unit *u);
-  void usetsiege(struct unit *u, const struct building *b);
+    const struct race *u_irace(const struct unit *u);
+    const struct race *u_race(const struct unit *u);
+    void u_setrace(struct unit *u, const struct race *);
+    struct building *usiege(const struct unit *u);
+    void usetsiege(struct unit *u, const struct building *b);
 
-  struct unit *utarget(const struct unit *u);
-  void usettarget(struct unit *u, const struct unit *b);
+    struct unit *utarget(const struct unit *u);
+    void usettarget(struct unit *u, const struct unit *b);
 
-  struct unit *utarget(const struct unit *u);
-  void usettarget(struct unit *u, const struct unit *b);
+    struct unit *utarget(const struct unit *u);
+    void usettarget(struct unit *u, const struct unit *b);
 
-  extern const struct race *urace(const struct unit *u);
+    extern const struct race *urace(const struct unit *u);
 
-  const char *uprivate(const struct unit *u);
-  void usetprivate(struct unit *u, const char *c);
+    const char *uprivate(const struct unit *u);
+    void usetprivate(struct unit *u, const char *c);
 
-  const struct potion_type *ugetpotionuse(const struct unit *u);        /* benutzt u einein trank? */
-  void usetpotionuse(struct unit *u, const struct potion_type *p);      /* u benutzt trank p (es darf halt nur einer pro runde) */
+    const struct potion_type *ugetpotionuse(const struct unit *u);        /* benutzt u einein trank? */
+    void usetpotionuse(struct unit *u, const struct potion_type *p);      /* u benutzt trank p (es darf halt nur einer pro runde) */
 
-  bool ucontact(const struct unit *u, const struct unit *u2);
-  void usetcontact(struct unit *u, const struct unit *c);
+    bool ucontact(const struct unit *u, const struct unit *u2);
+    void usetcontact(struct unit *u, const struct unit *c);
 
-  struct unit *findnewunit(const struct region *r, const struct faction *f,
-    int alias);
+    struct unit *findnewunit(const struct region *r, const struct faction *f,
+        int alias);
 
-  const char *u_description(const unit * u, const struct locale *lang);
-  struct skill *add_skill(struct unit *u, skill_t id);
-  void remove_skill(struct unit *u, skill_t sk);
-  struct skill *unit_skill(const struct unit *u, skill_t id);
-  bool has_skill(const unit * u, skill_t sk);
-  int effskill(const struct unit *u, skill_t sk);
-  int produceexp(struct unit *u, skill_t sk, int n);
-  int SkillCap(skill_t sk);
+    const char *u_description(const unit * u, const struct locale *lang);
+    struct skill *add_skill(struct unit *u, skill_t id);
+    void remove_skill(struct unit *u, skill_t sk);
+    struct skill *unit_skill(const struct unit *u, skill_t id);
+    bool has_skill(const unit * u, skill_t sk);
+    int effskill(const struct unit *u, skill_t sk);
+    int produceexp(struct unit *u, skill_t sk, int n);
+    int SkillCap(skill_t sk);
 
-  extern void set_level(struct unit *u, skill_t id, int level);
-  extern int get_level(const struct unit *u, skill_t id);
-  extern void transfermen(struct unit *u, struct unit *u2, int n);
+    extern void set_level(struct unit *u, skill_t id, int level);
+    extern int get_level(const struct unit *u, skill_t id);
+    extern void transfermen(struct unit *u, struct unit *u2, int n);
 
-  extern int eff_skill(const struct unit *u, skill_t sk,
-    const struct region *r);
-  extern int eff_skill_study(const struct unit *u, skill_t sk,
-    const struct region *r);
+    extern int eff_skill(const struct unit *u, skill_t sk,
+        const struct region *r);
+    extern int eff_skill_study(const struct unit *u, skill_t sk,
+        const struct region *r);
 
-  extern int get_modifier(const struct unit *u, skill_t sk, int lvl,
-    const struct region *r, bool noitem);
-  extern int remove_unit(struct unit **ulist, struct unit *u);
+    extern int get_modifier(const struct unit *u, skill_t sk, int lvl,
+        const struct region *r, bool noitem);
+    extern int remove_unit(struct unit **ulist, struct unit *u);
 
 #define GIFT_SELF     1<<0
 #define GIFT_FRIENDS  1<<1
 #define GIFT_PEASANTS 1<<2
-  int gift_items(struct unit *u, int flags);
-  void make_zombie(unit * u);
+    int gift_items(struct unit *u, int flags);
+    void make_zombie(unit * u);
 
-/* see resolve.h */
-  extern int resolve_unit(variant data, void *address);
-  extern void write_unit_reference(const struct unit *u, struct storage *store);
-  extern variant read_unit_reference(struct storage *store);
+    /* see resolve.h */
+    extern int resolve_unit(variant data, void *address);
+    extern void write_unit_reference(const struct unit *u, struct storage *store);
+    extern variant read_unit_reference(struct storage *store);
 
-  extern bool leave(struct unit *u, bool force);
-  extern bool can_leave(struct unit *u);
+    extern bool leave(struct unit *u, bool force);
+    extern bool can_leave(struct unit *u);
 
-  extern void u_set_building(struct unit * u, struct building * b);
-  extern void u_set_ship(struct unit * u, struct ship * sh);
-  extern void leave_ship(struct unit * u);
-  extern void leave_building(struct unit * u);
+    extern void u_set_building(struct unit * u, struct building * b);
+    extern void u_set_ship(struct unit * u, struct ship * sh);
+    extern void leave_ship(struct unit * u);
+    extern void leave_building(struct unit * u);
 
-  extern void set_leftship(struct unit *u, struct ship *sh);
-  extern struct ship *leftship(const struct unit *);
-  extern bool can_survive(const struct unit *u, const struct region *r);
-  extern void move_unit(struct unit *u, struct region *target,
+    extern void set_leftship(struct unit *u, struct ship *sh);
+    extern struct ship *leftship(const struct unit *);
+    extern bool can_survive(const struct unit *u, const struct region *r);
+    extern void move_unit(struct unit *u, struct region *target,
     struct unit **ulist);
 
-  extern struct building *inside_building(const struct unit *u);
+    extern struct building *inside_building(const struct unit *u);
 
-/* cleanup code for this module */
-  extern void free_units(void);
-  extern struct faction *dfindhash(int no);
-  extern void u_setfaction(struct unit *u, struct faction *f);
-  extern void set_number(struct unit *u, int count);
+    /* cleanup code for this module */
+    extern void free_units(void);
+    extern struct faction *dfindhash(int no);
+    extern void u_setfaction(struct unit *u, struct faction *f);
+    extern void set_number(struct unit *u, int count);
 
-  extern bool learn_skill(struct unit *u, skill_t sk, double chance);
+    extern bool learn_skill(struct unit *u, skill_t sk, double chance);
 
-  extern int invisible(const struct unit *target, const struct unit *viewer);
-  extern void free_unit(struct unit *u);
+    extern int invisible(const struct unit *target, const struct unit *viewer);
+    extern void free_unit(struct unit *u);
 
-  extern void name_unit(struct unit *u);
-  extern struct unit *create_unit(struct region *r1, struct faction *f,
-    int number, const struct race *rc, int id, const char *dname,
+    extern void name_unit(struct unit *u);
+    extern struct unit *create_unit(struct region *r1, struct faction *f,
+        int number, const struct race *rc, int id, const char *dname,
     struct unit *creator);
 
-  void uhash(struct unit *u);
-  void uunhash(struct unit *u);
-  struct unit *ufindhash(int i);
+    void uhash(struct unit *u);
+    void uunhash(struct unit *u);
+    struct unit *ufindhash(int i);
 
-  const char *unit_getname(const struct unit *u);
-  void unit_setname(struct unit *u, const char *name);
-  const char *unit_getinfo(const struct unit *u);
-  void unit_setinfo(struct unit *u, const char *name);
-  int unit_getid(const unit * u);
-  void unit_setid(unit * u, int id);
-  int unit_gethp(const unit * u);
-  void unit_sethp(unit * u, int id);
-  status_t unit_getstatus(const unit * u);
-  void unit_setstatus(unit * u, status_t status);
-  int unit_getweight(const unit * u);
-  int unit_getcapacity(const unit * u);
-  void unit_addorder(unit * u, struct order *ord);
-  int unit_max_hp(const struct unit *u);
-  void scale_number(struct unit *u, int n);
+    const char *unit_getname(const struct unit *u);
+    void unit_setname(struct unit *u, const char *name);
+    const char *unit_getinfo(const struct unit *u);
+    void unit_setinfo(struct unit *u, const char *name);
+    int unit_getid(const unit * u);
+    void unit_setid(unit * u, int id);
+    int unit_gethp(const unit * u);
+    void unit_sethp(unit * u, int id);
+    status_t unit_getstatus(const unit * u);
+    void unit_setstatus(unit * u, status_t status);
+    int unit_getweight(const unit * u);
+    int unit_getcapacity(const unit * u);
+    void unit_addorder(unit * u, struct order *ord);
+    int unit_max_hp(const struct unit *u);
+    void scale_number(struct unit *u, int n);
 
-  struct spellbook * unit_get_spellbook(const struct unit * u);
-  void unit_add_spell(struct unit * u, struct sc_mage * m, struct spell * sp, int level);
-  void remove_empty_units_in_region(struct region * r);
-  void remove_empty_units(void);
+    struct spellbook * unit_get_spellbook(const struct unit * u);
+    void unit_add_spell(struct unit * u, struct sc_mage * m, struct spell * sp, int level);
+    void remove_empty_units_in_region(struct region * r);
+    void remove_empty_units(void);
 
-  struct unit *findunitg(int n, const struct region *hint);
-  struct unit *findunit(int n);
+    struct unit *findunitg(int n, const struct region *hint);
+    struct unit *findunit(int n);
 
-  struct unit *findunitr(const struct region *r, int n);
+    struct unit *findunitr(const struct region *r, int n);
 
-  const char *unitname(const struct unit *u);
-  char *write_unitname(const struct unit *u, char *buffer, size_t size);
-  bool unit_name_equals_race(const struct unit *u);
-  bool unit_can_study(const struct unit *u);
+    const char *unitname(const struct unit *u);
+    char *write_unitname(const struct unit *u, char *buffer, size_t size);
+    bool unit_name_equals_race(const struct unit *u);
+    bool unit_can_study(const struct unit *u);
 
 #ifdef __cplusplus
 }
diff --git a/src/kernel/version.h b/src/kernel/version.h
index e54b387db..516893437 100644
--- a/src/kernel/version.h
+++ b/src/kernel/version.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  +-------------------+  
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
diff --git a/src/kernel/xmlreader.c b/src/kernel/xmlreader.c
index 5061abb07..055615d02 100644
--- a/src/kernel/xmlreader.c
+++ b/src/kernel/xmlreader.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
 +-------------------+
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Christian Schlittchen <corwin@amber.kn-bremen.de>
@@ -170,7 +170,7 @@ construction ** consPtr)
         con->defense_bonus = xml_ivalue(node, "defense_bonus", 0);
         con->close_combat_bonus = xml_ivalue(node, "close_combat_bonus", 0);
         con->ranged_bonus = xml_ivalue(node, "ranged_bonus", 0);
-        
+
         propValue = xmlGetProp(node, BAD_CAST "building");
         if (propValue != NULL) {
             con->btype = bt_get_or_create((const char *)propValue);
diff --git a/src/kernel/xmlreader.h b/src/kernel/xmlreader.h
index acf18f12a..5dfb643f1 100644
--- a/src/kernel/xmlreader.h
+++ b/src/kernel/xmlreader.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
 +-------------------+
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Christian Schlittchen <corwin@amber.kn-bremen.de>
diff --git a/src/keyword.h b/src/keyword.h
index b8094e74d..9d5e20f64 100644
--- a/src/keyword.h
+++ b/src/keyword.h
@@ -7,83 +7,83 @@ extern "C"
 {
 #endif
 
-struct locale;
+    struct locale;
 
-typedef enum {
-    K_KOMMENTAR,
-    K_BANNER,
-    K_WORK,
-    K_ATTACK,
-    K_STEAL,
-    K_BESIEGE,
-    K_NAME,
-    K_USE,
-    K_DISPLAY,
-    K_ENTER,
-    K_GUARD,
-    K_MAIL,
-    K_END,
-    K_DRIVE,
-    K_NUMBER,
-    K_FOLLOW,
-    K_RESEARCH,
-    K_GIVE,
-    K_ALLY,
-    K_STATUS,
-    K_COMBATSPELL,
-    K_BUY,
-    K_CONTACT,
-    K_TEACH,
-    K_STUDY,
-    K_MAKE,
-    K_MAKETEMP,
-    K_MOVE,
-    K_PASSWORD,
-    K_RECRUIT,
-    K_RESERVE,
-    K_ROUTE,
-    K_SABOTAGE,
-    K_SEND,
-    K_SPY,
-    K_QUIT,
-    K_SETSTEALTH,
-    K_TRANSPORT,
-    K_TAX,
-    K_ENTERTAIN,
-    K_SELL,
-    K_LEAVE,
-    K_FORGET,
-    K_CAST,
-    K_RESHOW,
-    K_DESTROY,
-    K_BREED,
-    K_DEFAULT,
-    K_URSPRUNG,
-    K_EMAIL,
-    K_PIRACY,
-    K_GROUP,
-    K_SORT,
-    K_PREFIX,
-    K_ALLIANCE,
-    K_CLAIM,
-    K_PROMOTION,
-    K_PAY,
-    K_LOOT,
-    MAXKEYWORDS,
-    NOKEYWORD = -1
-} keyword_t;
+    typedef enum {
+        K_KOMMENTAR,
+        K_BANNER,
+        K_WORK,
+        K_ATTACK,
+        K_STEAL,
+        K_BESIEGE,
+        K_NAME,
+        K_USE,
+        K_DISPLAY,
+        K_ENTER,
+        K_GUARD,
+        K_MAIL,
+        K_END,
+        K_DRIVE,
+        K_NUMBER,
+        K_FOLLOW,
+        K_RESEARCH,
+        K_GIVE,
+        K_ALLY,
+        K_STATUS,
+        K_COMBATSPELL,
+        K_BUY,
+        K_CONTACT,
+        K_TEACH,
+        K_STUDY,
+        K_MAKE,
+        K_MAKETEMP,
+        K_MOVE,
+        K_PASSWORD,
+        K_RECRUIT,
+        K_RESERVE,
+        K_ROUTE,
+        K_SABOTAGE,
+        K_SEND,
+        K_SPY,
+        K_QUIT,
+        K_SETSTEALTH,
+        K_TRANSPORT,
+        K_TAX,
+        K_ENTERTAIN,
+        K_SELL,
+        K_LEAVE,
+        K_FORGET,
+        K_CAST,
+        K_RESHOW,
+        K_DESTROY,
+        K_BREED,
+        K_DEFAULT,
+        K_URSPRUNG,
+        K_EMAIL,
+        K_PIRACY,
+        K_GROUP,
+        K_SORT,
+        K_PREFIX,
+        K_ALLIANCE,
+        K_CLAIM,
+        K_PROMOTION,
+        K_PAY,
+        K_LOOT,
+        MAXKEYWORDS,
+        NOKEYWORD = -1
+    } keyword_t;
 
-extern const char *keywords[MAXKEYWORDS];
+    extern const char *keywords[MAXKEYWORDS];
+
+    keyword_t findkeyword(const char *s);
+    keyword_t get_keyword(const char *s, const struct locale *lang);
+    void init_keywords(const struct locale *lang);
+    void init_keyword(const struct locale *lang, keyword_t kwd, const char *str);
+    bool keyword_disabled(keyword_t kwd);
+    void enable_keyword(keyword_t kwd, bool enabled);
+    const char *keyword(keyword_t kwd);
+    // #define keyword(kwd) mkname("keyword", keywords[kwd])
 
-keyword_t findkeyword(const char *s);
-keyword_t get_keyword(const char *s, const struct locale *lang);
-void init_keywords(const struct locale *lang);
-void init_keyword(const struct locale *lang, keyword_t kwd, const char *str);
-bool keyword_disabled(keyword_t kwd);
-void enable_keyword(keyword_t kwd, bool enabled);
-const char *keyword(keyword_t kwd);
-// #define keyword(kwd) mkname("keyword", keywords[kwd])
-  
 #ifdef __cplusplus
 #endif
 #endif
diff --git a/src/keyword.test.c b/src/keyword.test.c
index 6ccb04e39..9aa297009 100644
--- a/src/keyword.test.c
+++ b/src/keyword.test.c
@@ -97,12 +97,12 @@ static void test_get_shortest_match(CuTest *tc) {
 
 CuSuite *get_keyword_suite(void)
 {
-  CuSuite *suite = CuSuiteNew();
-  SUITE_ADD_TEST(suite, test_infinitive);
-  SUITE_ADD_TEST(suite, test_init_keyword);
-  SUITE_ADD_TEST(suite, test_init_keywords);
-  SUITE_ADD_TEST(suite, test_findkeyword);
-  SUITE_ADD_TEST(suite, test_get_shortest_match);
-  SUITE_DISABLE_TEST(suite, test_get_keyword_default);
-  return suite;
+    CuSuite *suite = CuSuiteNew();
+    SUITE_ADD_TEST(suite, test_infinitive);
+    SUITE_ADD_TEST(suite, test_init_keyword);
+    SUITE_ADD_TEST(suite, test_init_keywords);
+    SUITE_ADD_TEST(suite, test_findkeyword);
+    SUITE_ADD_TEST(suite, test_get_shortest_match);
+    SUITE_DISABLE_TEST(suite, test_get_keyword_default);
+    return suite;
 }
diff --git a/src/laws.c b/src/laws.c
index 761ddab00..0654db184 100755
--- a/src/laws.c
+++ b/src/laws.c
@@ -470,10 +470,10 @@ growing_trees_e3(region * r, const int current_season,
 const int last_weeks_season)
 {
     static const int transform[4][3] = {
-            { -1, -1, 0 },
-            { TREE_SEED, TREE_SAPLING, 2 },
-            { TREE_SAPLING, TREE_TREE, 2 },
-            { TREE_TREE, TREE_SEED, 2 }
+        { -1, -1, 0 },
+        { TREE_SEED, TREE_SAPLING, 2 },
+        { TREE_SAPLING, TREE_TREE, 2 },
+        { TREE_TREE, TREE_SEED, 2 }
     };
 
     if (r->land && current_season != last_weeks_season
@@ -677,7 +677,7 @@ void immigration(void)
 {
     region *r;
     log_info(" - Einwanderung...");
-    int repopulate=get_param_int(global.parameters, "rules.economy.repopulate_maximum", 90);
+    int repopulate = get_param_int(global.parameters, "rules.economy.repopulate_maximum", 90);
     for (r = regions; r; r = r->next) {
         if (r->land && r->land->newpeasants) {
             int rp = rpeasants(r) + r->land->newpeasants;
@@ -686,7 +686,7 @@ void immigration(void)
         /* Genereate some (0-2 to 0-6 depending on the income) peasants out of nothing */
         /*if less then 50 are in the region and there is space and no monster or deamon units in the region */
         int peasants = rpeasants(r);
-        if (repopulate && r->land && (peasants < repopulate) && maxworkingpeasants(r) > (peasants+30)*2)
+        if (repopulate && r->land && (peasants < repopulate) && maxworkingpeasants(r) >(peasants + 30) * 2)
         {
             int badunit = 0;
             unit *u;
@@ -925,7 +925,7 @@ int quit_cmd(unit * u, struct order *ord)
     faction *f = u->faction;
     const char *passwd;
     keyword_t kwd;
-    
+
     kwd = init_order(ord);
     assert(kwd == K_QUIT);
     passwd = gettoken(token, sizeof(token));
@@ -968,7 +968,7 @@ static bool CheckOverload(void)
     if (value < 0) {
         value = get_param_int(global.parameters, "rules.check_overload", 0);
     }
-    return value!=0;
+    return value != 0;
 }
 
 int enter_ship(unit * u, struct order *ord, int id, bool report)
@@ -979,7 +979,7 @@ int enter_ship(unit * u, struct order *ord, int id, bool report)
 
     /* Muss abgefangen werden, sonst koennten Schwimmer an
      * Bord von Schiffen an Land gelangen. */
-    if (!(rc->flags & (RCF_CANSAIL|RCF_WALK|RCF_FLY))) {
+    if (!(rc->flags & (RCF_CANSAIL | RCF_WALK | RCF_FLY))) {
         if (report) {
             cmistake(u, ord, 233, MSG_MOVE);
         }
@@ -1229,18 +1229,18 @@ static void remove_idle_players(void)
     age = calloc(_max(4, turn + 1), sizeof(int));
     for (f = factions; f; f = f->next)
         if (!is_monsters(f)) {
-        if (RemoveNMRNewbie() && !fval(f, FFL_NOIDLEOUT)) {
-            if (f->age >= 0 && f->age <= turn)
-                ++age[f->age];
-            if (f->age == 2 || f->age == 3) {
-                if (f->lastorders == turn - 2) {
-                    destroyfaction(f);
-                    ++dropouts[f->age - 2];
-                    continue;
+            if (RemoveNMRNewbie() && !fval(f, FFL_NOIDLEOUT)) {
+                if (f->age >= 0 && f->age <= turn)
+                    ++age[f->age];
+                if (f->age == 2 || f->age == 3) {
+                    if (f->lastorders == turn - 2) {
+                        destroyfaction(f);
+                        ++dropouts[f->age - 2];
+                        continue;
+                    }
                 }
             }
         }
-        }
 }
 
 void quit(void)
@@ -1858,7 +1858,7 @@ int name_cmd(struct unit *u, struct order *ord)
             break;
         }
     }
-        break;
+    break;
     default:
         cmistake(u, ord, 109, MSG_EVENT);
         break;
diff --git a/src/laws.h b/src/laws.h
index 27232982b..4d1bc06ad 100755
--- a/src/laws.h
+++ b/src/laws.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -38,7 +38,7 @@ extern "C" {
     void update_guards(void);
     void update_subscriptions(void);
     void deliverMail(struct faction *f, struct region *r, struct unit *u,
-                     const char *s, struct unit *receiver);
+        const char *s, struct unit *receiver);
 
     bool renamed_building(const struct building * b);
     int rename_building(struct unit * u, struct order * ord, struct building * b, const char *name);
@@ -49,63 +49,63 @@ extern "C" {
     int enter_ship(struct unit *u, struct order *ord, int id, bool report);
 
     /* eressea-specific. put somewhere else, please. */
-  void processorders(void);
-  extern struct attrib_type at_germs;
+    void processorders(void);
+    extern struct attrib_type at_germs;
 
-  extern int dropouts[2];
-  extern int *age;
+    extern int dropouts[2];
+    extern int *age;
 
 
-  extern void new_units(void);
-  extern void defaultorders(void);
-  extern void quit(void);
-  extern void monthly_healing(void);
-  extern void renumber_factions(void);
-  extern void restack_units(void);
-  extern void update_long_order(struct unit *u);
-  extern void sinkships(struct region * r);
-  extern void do_enter(struct region *r, bool is_final_attempt);
+    extern void new_units(void);
+    extern void defaultorders(void);
+    extern void quit(void);
+    extern void monthly_healing(void);
+    extern void renumber_factions(void);
+    extern void restack_units(void);
+    extern void update_long_order(struct unit *u);
+    extern void sinkships(struct region * r);
+    extern void do_enter(struct region *r, bool is_final_attempt);
 
-  extern int password_cmd(struct unit *u, struct order *ord);
-  extern int banner_cmd(struct unit *u, struct order *ord);
-  extern int email_cmd(struct unit *u, struct order *ord);
-  extern int send_cmd(struct unit *u, struct order *ord);
-  extern int ally_cmd(struct unit* u, struct order *ord);
-  extern int prefix_cmd(struct unit *u, struct order *ord);
-  extern int setstealth_cmd(struct unit *u, struct order *ord);
-  extern int status_cmd(struct unit *u, struct order *ord);
-  extern int display_cmd(struct unit *u, struct order *ord);
-  extern int group_cmd(struct unit *u, struct order *ord);
-  extern int origin_cmd(struct unit *u, struct order *ord);
-  extern int quit_cmd(struct unit *u, struct order *ord);
-  extern int name_cmd(struct unit *u, struct order *ord);
-  extern int use_cmd(struct unit *u, struct order *ord);
-  extern int siege_cmd(struct unit *u, struct order *ord);
-  extern int leave_cmd(struct unit *u, struct order *ord);
-  extern int pay_cmd(struct unit *u, struct order *ord);
-  extern int promotion_cmd(struct unit *u, struct order *ord);
-  extern int renumber_cmd(struct unit *u, struct order *ord);
-  extern int combatspell_cmd(struct unit *u, struct order *ord);
-  extern int contact_cmd(struct unit *u, struct order *ord);
-  extern int guard_on_cmd(struct unit *u, struct order *ord);
-  extern int guard_off_cmd(struct unit *u, struct order *ord);
-  extern int reshow_cmd(struct unit *u, struct order *ord);
-  extern int mail_cmd(struct unit *u, struct order *ord);
-  extern int reserve_cmd(struct unit *u, struct order *ord);
-  extern int reserve_self(struct unit *u, struct order *ord);
-  extern int claim_cmd(struct unit *u, struct order *ord);
-  extern int follow_cmd(struct unit *u, struct order *ord);
+    extern int password_cmd(struct unit *u, struct order *ord);
+    extern int banner_cmd(struct unit *u, struct order *ord);
+    extern int email_cmd(struct unit *u, struct order *ord);
+    extern int send_cmd(struct unit *u, struct order *ord);
+    extern int ally_cmd(struct unit* u, struct order *ord);
+    extern int prefix_cmd(struct unit *u, struct order *ord);
+    extern int setstealth_cmd(struct unit *u, struct order *ord);
+    extern int status_cmd(struct unit *u, struct order *ord);
+    extern int display_cmd(struct unit *u, struct order *ord);
+    extern int group_cmd(struct unit *u, struct order *ord);
+    extern int origin_cmd(struct unit *u, struct order *ord);
+    extern int quit_cmd(struct unit *u, struct order *ord);
+    extern int name_cmd(struct unit *u, struct order *ord);
+    extern int use_cmd(struct unit *u, struct order *ord);
+    extern int siege_cmd(struct unit *u, struct order *ord);
+    extern int leave_cmd(struct unit *u, struct order *ord);
+    extern int pay_cmd(struct unit *u, struct order *ord);
+    extern int promotion_cmd(struct unit *u, struct order *ord);
+    extern int renumber_cmd(struct unit *u, struct order *ord);
+    extern int combatspell_cmd(struct unit *u, struct order *ord);
+    extern int contact_cmd(struct unit *u, struct order *ord);
+    extern int guard_on_cmd(struct unit *u, struct order *ord);
+    extern int guard_off_cmd(struct unit *u, struct order *ord);
+    extern int reshow_cmd(struct unit *u, struct order *ord);
+    extern int mail_cmd(struct unit *u, struct order *ord);
+    extern int reserve_cmd(struct unit *u, struct order *ord);
+    extern int reserve_self(struct unit *u, struct order *ord);
+    extern int claim_cmd(struct unit *u, struct order *ord);
+    extern int follow_cmd(struct unit *u, struct order *ord);
 
-  bool cansee(const struct faction *f, const struct region *r,
-      const struct unit *u, int modifier);
-  bool cansee_durchgezogen(const struct faction *f, const struct region *r,
-      const struct unit *u, int modifier);
-  bool cansee_unit(const struct unit *u, const struct unit *target,
-      int modifier);
-  bool seefaction(const struct faction *f, const struct region *r,
-      const struct unit *u, int modifier);
-  int armedmen(const struct unit *u, bool siege_weapons);
-  void force_leave(struct region *r);
+    bool cansee(const struct faction *f, const struct region *r,
+        const struct unit *u, int modifier);
+    bool cansee_durchgezogen(const struct faction *f, const struct region *r,
+        const struct unit *u, int modifier);
+    bool cansee_unit(const struct unit *u, const struct unit *target,
+        int modifier);
+    bool seefaction(const struct faction *f, const struct region *r,
+        const struct unit *u, int modifier);
+    int armedmen(const struct unit *u, bool siege_weapons);
+    void force_leave(struct region *r);
 
 
 #ifdef __cplusplus
diff --git a/src/lighthouse.h b/src/lighthouse.h
index 6000248ba..fbf56361e 100644
--- a/src/lighthouse.h
+++ b/src/lighthouse.h
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/listbox.c b/src/listbox.c
index 91ff14c1e..525970637 100644
--- a/src/listbox.c
+++ b/src/listbox.c
@@ -1,11 +1,11 @@
-/* vi: set ts=2:
+/* 
 * +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
 * |                   |  Enno Rehling <enno@eressea.de>
 * | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
-* | (c) 1998 - 2006   |  
+* | (c) 1998 - 2006   |
 * |                   |  This program may not be used, modified or distributed
 * +-------------------+  without prior permission by the authors of Eressea.
-*  
+*
 */
 
 /* wenn platform.h nicht vor curses included wird, kompiliert es unter windows nicht */
@@ -24,193 +24,195 @@
 
 void
 insert_selection(list_selection ** p_sel, list_selection * prev,
-  const char *str, void *payload)
+const char *str, void *payload)
 {
-  list_selection *sel = calloc(sizeof(list_selection), 1);
-  sel->str = _strdup(str);
-  sel->data = payload;
-  if (*p_sel) {
-    list_selection *s;
-    sel->next = *p_sel;
-    sel->prev = sel->next->prev;
-    sel->next->prev = sel;
-    if (sel->prev) {
-      sel->prev->next = sel;
-      sel->index = sel->prev->index + 1;
+    list_selection *sel = calloc(sizeof(list_selection), 1);
+    sel->str = _strdup(str);
+    sel->data = payload;
+    if (*p_sel) {
+        list_selection *s;
+        sel->next = *p_sel;
+        sel->prev = sel->next->prev;
+        sel->next->prev = sel;
+        if (sel->prev) {
+            sel->prev->next = sel;
+            sel->index = sel->prev->index + 1;
+        }
+        for (s = sel->next; s; s = s->next) {
+            s->index = s->prev->index + 1;
+        }
+        *p_sel = sel;
     }
-    for (s = sel->next; s; s = s->next) {
-      s->index = s->prev->index + 1;
+    else {
+        *p_sel = sel;
+        sel->prev = prev;
+        if (prev)
+            sel->index = prev->index + 1;
     }
-    *p_sel = sel;
-  } else {
-    *p_sel = sel;
-    sel->prev = prev;
-    if (prev)
-      sel->index = prev->index + 1;
-  }
 }
 
 list_selection **push_selection(list_selection ** p_sel, char *str,
-  void *payload)
+    void *payload)
 {
-  list_selection *sel = calloc(sizeof(list_selection), 1);
-  list_selection *prev = NULL;
-  sel->str = str;
-  sel->data = payload;
-  while (*p_sel) {
-    prev = *p_sel;
-    p_sel = &prev->next;
-  }
-  *p_sel = sel;
-  if (prev) {
-    sel->prev = prev;
-    sel->index = prev->index + 1;
-  }
-  return p_sel;
+    list_selection *sel = calloc(sizeof(list_selection), 1);
+    list_selection *prev = NULL;
+    sel->str = str;
+    sel->data = payload;
+    while (*p_sel) {
+        prev = *p_sel;
+        p_sel = &prev->next;
+    }
+    *p_sel = sel;
+    if (prev) {
+        sel->prev = prev;
+        sel->index = prev->index + 1;
+    }
+    return p_sel;
 }
 
 #define SX (getmaxx(stdscr))
 #define SY (getmaxy(stdscr))
 
 list_selection *do_selection(list_selection * sel, const char *title,
-  void (*perform) (list_selection *, void *), void *data)
+    void(*perform) (list_selection *, void *), void *data)
 {
-  WINDOW *wn;
-  bool update = true;
-  list_selection *s;
-  list_selection *top = sel;
-  list_selection *current = top;
-  int i;
-  int height = 0, width = (int)strlen(title) + 8;
-  for (s = sel; s; s = s->next) {
-    if ((int)strlen(s->str) > width) {
-      width = (int)strlen(s->str);
+    WINDOW *wn;
+    bool update = true;
+    list_selection *s;
+    list_selection *top = sel;
+    list_selection *current = top;
+    int i;
+    int height = 0, width = (int)strlen(title) + 8;
+    for (s = sel; s; s = s->next) {
+        if ((int)strlen(s->str) > width) {
+            width = (int)strlen(s->str);
+        }
+        ++height;
+        if (verbosity >= 5) {
+            log_printf(stdout, "s %s w %d h %d\n", s->str, width, height);
+        }
     }
-    ++height;
-    if (verbosity >= 5) {
-      log_printf(stdout, "s %s w %d h %d\n", s->str, width, height);
-    }
-  }
-  if (height == 0 || width == 0)
-    return 0;
-  if (width + 3 > SX)
-    width = SX - 4;
-  if (height + 2 > SY)
-    height = SY - 2;
+    if (height == 0 || width == 0)
+        return 0;
+    if (width + 3 > SX)
+        width = SX - 4;
+    if (height + 2 > SY)
+        height = SY - 2;
 
-  if (verbosity >= 5)
-    log_printf(stdout, "w %d h %d\n", width, height);
+    if (verbosity >= 5)
+        log_printf(stdout, "w %d h %d\n", width, height);
 
-  wn =
-    newwin(height + 2, width + 4, (SY - height - 2) / 2, (SX - width - 4) / 2);
+    wn =
+        newwin(height + 2, width + 4, (SY - height - 2) / 2, (SX - width - 4) / 2);
 
-  for (;;) {
-    int input;
-    if (update) {
-      for (s = top; s != NULL && top->index + height != s->index; s = s->next) {
-        i = s->index - top->index;
+    for (;;) {
+        int input;
+        if (update) {
+            for (s = top; s != NULL && top->index + height != s->index; s = s->next) {
+                i = s->index - top->index;
+                wmove(wn, i + 1, 4);
+                waddnstr(wn, s->str, -1);
+                wclrtoeol(wn);
+            }
+            wclrtobot(wn);
+            wxborder(wn);
+            mvwprintw(wn, 0, 2, "[ %s ]", title);
+            update = false;
+        }
+        i = current->index - top->index;
+        wattron(wn, A_BOLD | COLOR_PAIR(COLOR_YELLOW));
+        wmove(wn, i + 1, 2);
+        waddstr(wn, "->");
         wmove(wn, i + 1, 4);
-        waddnstr(wn, s->str, -1);
-        wclrtoeol(wn);
-      }
-      wclrtobot(wn);
-      wxborder(wn);
-      mvwprintw(wn, 0, 2, "[ %s ]", title);
-      update = false;
-    }
-    i = current->index - top->index;
-    wattron(wn, A_BOLD | COLOR_PAIR(COLOR_YELLOW));
-    wmove(wn, i + 1, 2);
-    waddstr(wn, "->");
-    wmove(wn, i + 1, 4);
-    waddnstr(wn, current->str, width - 2);
-    wattroff(wn, A_BOLD | COLOR_PAIR(COLOR_YELLOW));
+        waddnstr(wn, current->str, width - 2);
+        wattroff(wn, A_BOLD | COLOR_PAIR(COLOR_YELLOW));
 
-    wrefresh(wn);
+        wrefresh(wn);
 
-    input = getch();
+        input = getch();
 
-    wmove(wn, i + 1, 2);
-    waddstr(wn, "  ");
-    wmove(wn, i + 1, 4);
-    waddnstr(wn, current->str, width);
+        wmove(wn, i + 1, 2);
+        waddstr(wn, "  ");
+        wmove(wn, i + 1, 4);
+        waddnstr(wn, current->str, width);
 
-    switch (input) {
-      case KEY_NPAGE:
-        for (i = 0; i != height / 2; ++i) {
-          if (current->next) {
-            current = current->next;
-            if (current->index - height >= top->index) {
-              top = current;
-              update = true;
+        switch (input) {
+        case KEY_NPAGE:
+            for (i = 0; i != height / 2; ++i) {
+                if (current->next) {
+                    current = current->next;
+                    if (current->index - height >= top->index) {
+                        top = current;
+                        update = true;
+                    }
+                }
             }
-          }
-        }
-        break;
-      case KEY_PPAGE:
-        for (i = 0; i != height / 2; ++i) {
-          if (current->prev) {
-            if (current == top) {
-              top = sel;
-              while (top->index + height < current->index)
-                top = top->next;
-              update = true;
+            break;
+        case KEY_PPAGE:
+            for (i = 0; i != height / 2; ++i) {
+                if (current->prev) {
+                    if (current == top) {
+                        top = sel;
+                        while (top->index + height < current->index)
+                            top = top->next;
+                        update = true;
+                    }
+                    current = current->prev;
+                }
             }
-            current = current->prev;
-          }
-        }
-        break;
-      case KEY_DOWN:
-        if (current->next) {
-          current = current->next;
-          if (current->index - height >= top->index) {
-            top = current;
-            update = true;
-          }
-        }
-        break;
-      case KEY_UP:
-        if (current->prev) {
-          if (current == top) {
-            top = sel;
-            while (top->index + height < current->index)
-              top = top->next;
-            update = true;
-          }
-          current = current->prev;
-        }
-        break;
-      case 27:
-      case 'q':
-        delwin(wn);
-        return NULL;
-      case 10:
-      case 13:
-        if (perform)
-          perform(current, data);
-        else {
-          delwin(wn);
-          return current;
-        }
-        break;
-      default:
-        s = current->next;
-        if (s == NULL)
-          s = top;
-        while (s != current) {
-          if (tolower(s->str[0]) == tolower(input)) {
-            current = s;
-            update = true;
-          } else {
-            s = s->next;
+            break;
+        case KEY_DOWN:
+            if (current->next) {
+                current = current->next;
+                if (current->index - height >= top->index) {
+                    top = current;
+                    update = true;
+                }
+            }
+            break;
+        case KEY_UP:
+            if (current->prev) {
+                if (current == top) {
+                    top = sel;
+                    while (top->index + height < current->index)
+                        top = top->next;
+                    update = true;
+                }
+                current = current->prev;
+            }
+            break;
+        case 27:
+        case 'q':
+            delwin(wn);
+            return NULL;
+        case 10:
+        case 13:
+            if (perform)
+                perform(current, data);
+            else {
+                delwin(wn);
+                return current;
+            }
+            break;
+        default:
+            s = current->next;
             if (s == NULL)
-              s = top;
-          }
-        }
-        if (current->index - height >= top->index) {
-          top = current;
-          update = true;
+                s = top;
+            while (s != current) {
+                if (tolower(s->str[0]) == tolower(input)) {
+                    current = s;
+                    update = true;
+                }
+                else {
+                    s = s->next;
+                    if (s == NULL)
+                        s = top;
+                }
+            }
+            if (current->index - height >= top->index) {
+                top = current;
+                update = true;
+            }
         }
     }
-  }
 }
diff --git a/src/magic.c b/src/magic.c
index 073f1e405..72fe72a25 100644
--- a/src/magic.c
+++ b/src/magic.c
@@ -1377,7 +1377,7 @@ static void do_fumble(castorder * co)
         ADDMSG(&r->msgs, msg_message("patzer6", "unit region spell", u, r, sp));
         break;
     }
-        /* fall-through is intentional! */
+    /* fall-through is intentional! */
 
     case 2:
         /* temporary skill loss */
diff --git a/src/magic.h b/src/magic.h
index 03aee8fcb..96ad58535 100644
--- a/src/magic.h
+++ b/src/magic.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -25,136 +25,136 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-/* ------------------------------------------------------------- */
+    /* ------------------------------------------------------------- */
 
 #define MAXCOMBATSPELLS 3       /* PRECOMBAT COMBAT POSTCOMBAT */
 #define MAX_SPELLRANK 9         /* Standard-Rank 5 */
 #define MAXINGREDIENT	5       /* bis zu 5 Komponenten pro Zauber */
 #define CHAOSPATZERCHANCE 10    /* +10% Chance zu Patzern */
 
-/* ------------------------------------------------------------- */
+    /* ------------------------------------------------------------- */
 
 #define IRONGOLEM_CRUMBLE   15  /* monatlich Chance zu zerfallen */
 #define STONEGOLEM_CRUMBLE  10  /* monatlich Chance zu zerfallen */
 
-/* ------------------------------------------------------------- */
-/* Spruchparameter
- * Wir suchen beim Parsen des Befehls erstmal nach lokalen Objekten,
- * erst in verify_targets wird dann global gesucht, da in den meisten
- * F�llen das Zielobjekt lokal sein d�rfte */
+    /* ------------------------------------------------------------- */
+    /* Spruchparameter
+     * Wir suchen beim Parsen des Befehls erstmal nach lokalen Objekten,
+     * erst in verify_targets wird dann global gesucht, da in den meisten
+     * F�llen das Zielobjekt lokal sein d�rfte */
 
-/* siehe auch objtype_t in objtypes.h */
-  typedef enum {
-    SPP_REGION,                 /* "r" : findregion(x,y) -> *region */
-    SPP_UNIT,                   /*  -  : atoi36() -> int */
-    SPP_TEMP,                   /*  -  : temp einheit */
-    SPP_BUILDING,               /*  -  : atoi() -> int */
-    SPP_SHIP,                   /*  -  : atoi() -> int */
-    SPP_STRING,                 /* "c" */
-    SPP_INT                     /* "i" : atoi() -> int */
-  } sppobj_t;
+    /* siehe auch objtype_t in objtypes.h */
+    typedef enum {
+        SPP_REGION,                 /* "r" : findregion(x,y) -> *region */
+        SPP_UNIT,                   /*  -  : atoi36() -> int */
+        SPP_TEMP,                   /*  -  : temp einheit */
+        SPP_BUILDING,               /*  -  : atoi() -> int */
+        SPP_SHIP,                   /*  -  : atoi() -> int */
+        SPP_STRING,                 /* "c" */
+        SPP_INT                     /* "i" : atoi() -> int */
+    } sppobj_t;
 
-  typedef struct spllprm {
-    sppobj_t typ;
-    int flag;
-    union {
-      struct region *r;
-      struct unit *u;
-      struct building *b;
-      struct ship *sh;
-      char *s;
-      char *xs;
-      int i;
-    } data;
-  } spllprm;
+    typedef struct spllprm {
+        sppobj_t typ;
+        int flag;
+        union {
+            struct region *r;
+            struct unit *u;
+            struct building *b;
+            struct ship *sh;
+            char *s;
+            char *xs;
+            int i;
+        } data;
+    } spllprm;
 
-  typedef struct spellparameter {
-    int length;                 /* Anzahl der Elemente */
-    struct spllprm **param;
-  } spellparameter;
+    typedef struct spellparameter {
+        int length;                 /* Anzahl der Elemente */
+        struct spllprm **param;
+    } spellparameter;
 
-  typedef struct strarray {
-    int length;                 /* Anzahl der Elemente */
-    char **strings;
-  } strarray;
+    typedef struct strarray {
+        int length;                 /* Anzahl der Elemente */
+        char **strings;
+    } strarray;
 
 #define TARGET_RESISTS (1<<0)
 #define TARGET_NOTFOUND (1<<1)
 
-/* ------------------------------------------------------------- */
-/* Magierichtungen */
+    /* ------------------------------------------------------------- */
+    /* Magierichtungen */
 
-  extern const char *magic_school[MAXMAGIETYP];
+    extern const char *magic_school[MAXMAGIETYP];
 
-/* ------------------------------------------------------------- */
-/* Magier:
- * - Magierichtung
- * - Magiepunkte derzeit
- * - Malus (neg. Wert)/ Bonus (pos. Wert) auf maximale Magiepunkte
- *   (k�nnen sich durch Questen absolut ver�ndern und durch Gegenst�nde
- *   tempor�r). Auch f�r Artefakt ben�tigt man permanente MP
- * - Anzahl bereits gezauberte Spr�che diese Runde
- * - Kampfzauber (3) (vor/w�hrend/nach)
- * - Spruchliste
- */
+    /* ------------------------------------------------------------- */
+    /* Magier:
+     * - Magierichtung
+     * - Magiepunkte derzeit
+     * - Malus (neg. Wert)/ Bonus (pos. Wert) auf maximale Magiepunkte
+     *   (k�nnen sich durch Questen absolut ver�ndern und durch Gegenst�nde
+     *   tempor�r). Auch f�r Artefakt ben�tigt man permanente MP
+     * - Anzahl bereits gezauberte Spr�che diese Runde
+     * - Kampfzauber (3) (vor/w�hrend/nach)
+     * - Spruchliste
+     */
 
-typedef struct combatspell {
-  int level;
-  const struct spell *sp;
-} combatspell;
+    typedef struct combatspell {
+        int level;
+        const struct spell *sp;
+    } combatspell;
 
-typedef struct spell_names {
-  struct spell_names *next;
-  const struct locale *lang;
-  void * tokens;
-} spell_names;
+    typedef struct spell_names {
+        struct spell_names *next;
+        const struct locale *lang;
+        void * tokens;
+    } spell_names;
 
-typedef struct sc_mage {
-  magic_t magietyp;
-  int spellpoints;
-  int spchange;
-  int spellcount;
-  combatspell combatspells[MAXCOMBATSPELLS];
-  struct spellbook *spellbook;
-} sc_mage;
+    typedef struct sc_mage {
+        magic_t magietyp;
+        int spellpoints;
+        int spchange;
+        int spellcount;
+        combatspell combatspells[MAXCOMBATSPELLS];
+        struct spellbook *spellbook;
+    } sc_mage;
 
-/* ------------------------------------------------------------- */
-/* Zauberliste */
+    /* ------------------------------------------------------------- */
+    /* Zauberliste */
 
-  typedef struct castorder {
-    struct castorder *next;
-    union {
-      struct unit *u;
-      struct fighter *fig;
-    } magician;                 /* Magier (kann vom Typ struct unit oder fighter sein) */
-    struct unit *_familiar;     /* Vertrauter, gesetzt, wenn der Spruch durch
-                                   den Vertrauten gezaubert wird */
-    const struct spell *sp;     /* Spruch */
-    int level;                  /* gew�nschte Stufe oder Stufe des Magiers */
-    float force;               /* St�rke des Zaubers */
-    struct region *_rtarget;     /* Zielregion des Spruchs */
-    int distance;               /* Entfernung zur Zielregion */
-    struct order *order;        /* Befehl */
-    struct spellparameter *par; /* f�r weitere Parameter */
-  } castorder;
+    typedef struct castorder {
+        struct castorder *next;
+        union {
+            struct unit *u;
+            struct fighter *fig;
+        } magician;                 /* Magier (kann vom Typ struct unit oder fighter sein) */
+        struct unit *_familiar;     /* Vertrauter, gesetzt, wenn der Spruch durch
+                                       den Vertrauten gezaubert wird */
+        const struct spell *sp;     /* Spruch */
+        int level;                  /* gew�nschte Stufe oder Stufe des Magiers */
+        float force;               /* St�rke des Zaubers */
+        struct region *_rtarget;     /* Zielregion des Spruchs */
+        int distance;               /* Entfernung zur Zielregion */
+        struct order *order;        /* Befehl */
+        struct spellparameter *par; /* f�r weitere Parameter */
+    } castorder;
 
-  struct unit * co_get_caster(const struct castorder * co);
-  struct region * co_get_region(const struct castorder * co);
+    struct unit * co_get_caster(const struct castorder * co);
+    struct region * co_get_region(const struct castorder * co);
 
-  typedef struct spell_component {
-    const struct resource_type *type;
-    int amount;
-    int cost;
-  } spell_component;
+    typedef struct spell_component {
+        const struct resource_type *type;
+        int amount;
+        int cost;
+    } spell_component;
 
-/* ------------------------------------------------------------- */
+    /* ------------------------------------------------------------- */
 
-/* besondere Spruchtypen */
+    /* besondere Spruchtypen */
 #define FARCASTING      (1<<0)  /* ZAUBER [struct region x y] */
 #define SPELLLEVEL      (1<<1)  /* ZAUBER [STUFE x] */
 
-/* ID's k�nnen zu drei unterschiedlichen Entit�ten geh�ren: Einheiten,
- * Geb�uden und Schiffen. */
+    /* ID's k�nnen zu drei unterschiedlichen Entit�ten geh�ren: Einheiten,
+     * Geb�uden und Schiffen. */
 #define UNITSPELL       (1<<2)  /* ZAUBER .. <Einheit-Nr> [<Einheit-Nr> ..] */
 #define SHIPSPELL       (1<<3)  /* ZAUBER .. <Schiff-Nr> [<Schiff-Nr> ..] */
 #define BUILDINGSPELL   (1<<4)  /* ZAUBER .. <Gebaeude-Nr> [<Gebaeude-Nr> ..] */
@@ -166,204 +166,204 @@ typedef struct sc_mage {
 #define ISCOMBATSPELL   (PRECOMBATSPELL|COMBATSPELL|POSTCOMBATSPELL)
 
 #define OCEANCASTABLE   (1<<10) /* K�nnen auch nicht-Meermenschen auf
-                                   hoher See zaubern */
+     hoher See zaubern */
 #define ONSHIPCAST      (1<<11) /* kann auch auf von Land ablegenden
-                                   Schiffen stehend gezaubert werden */
-/*  */
+     Schiffen stehend gezaubert werden */
+    /*  */
 #define NOTFAMILIARCAST (1<<12)
 #define TESTRESISTANCE  (1<<13) /* alle Zielobjekte (u, s, b, r) auf
-                                   Magieresistenz pr�fen */
+                                       Magieresistenz pr�fen */
 #define SEARCHLOCAL     (1<<14) /* Ziel muss in der target_region sein */
 #define TESTCANSEE      (1<<15) /* alle Zielunits auf cansee pr�fen */
 #define ANYTARGET       (UNITSPELL|REGIONSPELL|BUILDINGSPELL|SHIPSPELL) /* wirkt auf alle objekttypen (unit, ship, building, region) */
 
-/* Flag Spruchkostenberechnung: */
-  enum {
-    SPC_FIX,                    /* Fixkosten */
-    SPC_LEVEL,                  /* Komponenten pro Level */
-    SPC_LINEAR                  /* Komponenten pro Level und m�ssen vorhanden sein */
-  };
+    /* Flag Spruchkostenberechnung: */
+    enum {
+        SPC_FIX,                    /* Fixkosten */
+        SPC_LEVEL,                  /* Komponenten pro Level */
+        SPC_LINEAR                  /* Komponenten pro Level und m�ssen vorhanden sein */
+    };
 
-  enum {
-    RS_DUMMY,
-    RS_FARVISION,
-    MAX_REGIONSPELLS
-  };
+    enum {
+        RS_DUMMY,
+        RS_FARVISION,
+        MAX_REGIONSPELLS
+    };
 
-/* ------------------------------------------------------------- */
-/* Prototypen */
+    /* ------------------------------------------------------------- */
+    /* Prototypen */
 
-  void magic(void);
+    void magic(void);
 
-  void regenerate_aura(void);
+    void regenerate_aura(void);
 
-  extern struct attrib_type at_seenspell;
-  extern struct attrib_type at_mage;
-  extern struct attrib_type at_familiarmage;
-  extern struct attrib_type at_familiar;
-  extern struct attrib_type at_clonemage;
-  extern struct attrib_type at_clone;
-  extern struct attrib_type at_reportspell;
-  extern struct attrib_type at_icastle;
+    extern struct attrib_type at_seenspell;
+    extern struct attrib_type at_mage;
+    extern struct attrib_type at_familiarmage;
+    extern struct attrib_type at_familiar;
+    extern struct attrib_type at_clonemage;
+    extern struct attrib_type at_clone;
+    extern struct attrib_type at_reportspell;
+    extern struct attrib_type at_icastle;
 
-  typedef struct icastle_data {
-    const struct building_type *type;
-    struct building *building;  /* reverse pointer to dissolve the object */
-    int time;
-  } icastle_data;
+    typedef struct icastle_data {
+        const struct building_type *type;
+        struct building *building;  /* reverse pointer to dissolve the object */
+        int time;
+    } icastle_data;
 
-/* ------------------------------------------------------------- */
-/* Kommentare:
- *
- * Spruchzauberrei und Gegenstandszauberrei werden getrennt behandelt.
- * Das macht u.a. bestimmte Fehlermeldungen einfacher, das
- * identifizieren der Komponennten �ber den Missversuch ist nicht
- * m�glich
- * Spruchzauberrei: 'ZAUBER [struct region x y] [STUFE a] "Spruchname" [Ziel]'
- * Gegenstandszauberrei: 'BENUTZE "Gegenstand" [Ziel]'
- *
- * Die Funktionen:
- */
+    /* ------------------------------------------------------------- */
+    /* Kommentare:
+     *
+     * Spruchzauberrei und Gegenstandszauberrei werden getrennt behandelt.
+     * Das macht u.a. bestimmte Fehlermeldungen einfacher, das
+     * identifizieren der Komponennten �ber den Missversuch ist nicht
+     * m�glich
+     * Spruchzauberrei: 'ZAUBER [struct region x y] [STUFE a] "Spruchname" [Ziel]'
+     * Gegenstandszauberrei: 'BENUTZE "Gegenstand" [Ziel]'
+     *
+     * Die Funktionen:
+     */
 
-/* Magier */
-  sc_mage *create_mage(struct unit *u, magic_t mtyp);
-  /*      macht die struct unit zu einem neuen Magier: legt die struct u->mage an
-   *      und     initialisiert den Magiertypus mit mtyp.  */
-  sc_mage *get_mage(const struct unit *u);
-  /*      gibt u->mage zur�ck, bei nicht-Magiern *NULL */
-  bool is_mage(const struct unit *u);
-  /*      gibt true, wenn u->mage gesetzt.  */
-  bool is_familiar(const struct unit *u);
-  /*      gibt true, wenn eine Familiar-Relation besteht.  */
+    /* Magier */
+    sc_mage *create_mage(struct unit *u, magic_t mtyp);
+    /*      macht die struct unit zu einem neuen Magier: legt die struct u->mage an
+     *      und     initialisiert den Magiertypus mit mtyp.  */
+    sc_mage *get_mage(const struct unit *u);
+    /*      gibt u->mage zur�ck, bei nicht-Magiern *NULL */
+    bool is_mage(const struct unit *u);
+    /*      gibt true, wenn u->mage gesetzt.  */
+    bool is_familiar(const struct unit *u);
+    /*      gibt true, wenn eine Familiar-Relation besteht.  */
 
-/* Spr�che */
-  int get_combatspelllevel(const struct unit *u, int nr);
-  /*  versucht, eine eingestellte maximale Kampfzauberstufe
-   *  zur�ckzugeben. 0 = Maximum, -1 u ist kein Magier. */
-  const struct spell *get_combatspell(const struct unit *u, int nr);
-  /*      gibt den Kampfzauber nr [pre/kampf/post] oder NULL zur�ck */
-  void set_combatspell(struct unit *u, struct spell * sp, struct order *ord,
-    int level);
-  /*      setzt Kampfzauber */
-  void unset_combatspell(struct unit *u, struct spell * sp);
-  /*      l�scht Kampfzauber */
-  /* f�gt den Spruch mit der Id spellid der Spruchliste der Einheit hinzu. */
-  int u_hasspell(const struct unit *u, const struct spell *sp);
-  /* pr�ft, ob der Spruch in der Spruchliste der Einheit steht. */
-  void pick_random_spells(struct faction *f, int level, struct spellbook * book, int num_spells);
-  void show_new_spells(struct faction * f, int level, const struct spellbook *book);
-  void updatespelllist(struct unit *u);
-  /* f�gt alle Zauber des Magiegebietes der Einheit, deren Stufe kleiner
-   * als das aktuelle Magietalent ist, in die Spruchliste der Einheit
-   * ein */
-  bool knowsspell(const struct region *r, const struct unit *u,
-    const struct spell * sp);
-  /* pr�ft, ob die Einheit diesen Spruch gerade beherrscht, dh
-   * mindestens die erforderliche Stufe hat. Hier k�nnen auch Abfragen
-   * auf spezielle Antimagiezauber auf Regionen oder Einheiten eingef�gt
-   * werden
-   */
+    /* Spr�che */
+    int get_combatspelllevel(const struct unit *u, int nr);
+    /*  versucht, eine eingestellte maximale Kampfzauberstufe
+     *  zur�ckzugeben. 0 = Maximum, -1 u ist kein Magier. */
+    const struct spell *get_combatspell(const struct unit *u, int nr);
+    /*      gibt den Kampfzauber nr [pre/kampf/post] oder NULL zur�ck */
+    void set_combatspell(struct unit *u, struct spell * sp, struct order *ord,
+        int level);
+    /*      setzt Kampfzauber */
+    void unset_combatspell(struct unit *u, struct spell * sp);
+    /*      l�scht Kampfzauber */
+    /* f�gt den Spruch mit der Id spellid der Spruchliste der Einheit hinzu. */
+    int u_hasspell(const struct unit *u, const struct spell *sp);
+    /* pr�ft, ob der Spruch in der Spruchliste der Einheit steht. */
+    void pick_random_spells(struct faction *f, int level, struct spellbook * book, int num_spells);
+    void show_new_spells(struct faction * f, int level, const struct spellbook *book);
+    void updatespelllist(struct unit *u);
+    /* f�gt alle Zauber des Magiegebietes der Einheit, deren Stufe kleiner
+     * als das aktuelle Magietalent ist, in die Spruchliste der Einheit
+     * ein */
+    bool knowsspell(const struct region *r, const struct unit *u,
+        const struct spell * sp);
+    /* pr�ft, ob die Einheit diesen Spruch gerade beherrscht, dh
+     * mindestens die erforderliche Stufe hat. Hier k�nnen auch Abfragen
+     * auf spezielle Antimagiezauber auf Regionen oder Einheiten eingef�gt
+     * werden
+     */
 
-/* Magiepunkte */
-  int get_spellpoints(const struct unit *u);
-  /*      Gibt die aktuelle Anzahl der Magiepunkte der Einheit zur�ck */
-  void set_spellpoints(struct unit *u, int sp);
-  /* setzt die Magiepunkte auf sp */
-  int change_spellpoints(struct unit *u, int mp);
-  /*      ver�ndert die Anzahl der Magiepunkte der Einheit um +mp */
-  int max_spellpoints(const struct region *r, const struct unit *u);
-  /*      gibt die aktuell maximal m�glichen Magiepunkte der Einheit zur�ck */
-  int change_maxspellpoints(struct unit *u, int csp);
-  /* ver�ndert die maximalen Magiepunkte einer Einheit */
+    /* Magiepunkte */
+    int get_spellpoints(const struct unit *u);
+    /*      Gibt die aktuelle Anzahl der Magiepunkte der Einheit zur�ck */
+    void set_spellpoints(struct unit *u, int sp);
+    /* setzt die Magiepunkte auf sp */
+    int change_spellpoints(struct unit *u, int mp);
+    /*      ver�ndert die Anzahl der Magiepunkte der Einheit um +mp */
+    int max_spellpoints(const struct region *r, const struct unit *u);
+    /*      gibt die aktuell maximal m�glichen Magiepunkte der Einheit zur�ck */
+    int change_maxspellpoints(struct unit *u, int csp);
+    /* ver�ndert die maximalen Magiepunkte einer Einheit */
 
-/* Zaubern */
-  extern float spellpower(struct region *r, struct unit *u, const struct spell * sp,
-    int cast_level, struct order *ord);
-  /*      ermittelt die St�rke eines Spruchs */
-  bool fumble(struct region *r, struct unit *u, const struct spell * sp,
-    int cast_level);
-  /*      true, wenn der Zauber misslingt, bei false gelingt der Zauber */
+    /* Zaubern */
+    extern float spellpower(struct region *r, struct unit *u, const struct spell * sp,
+        int cast_level, struct order *ord);
+    /*      ermittelt die St�rke eines Spruchs */
+    bool fumble(struct region *r, struct unit *u, const struct spell * sp,
+        int cast_level);
+    /*      true, wenn der Zauber misslingt, bei false gelingt der Zauber */
 
-  typedef struct spellrank {
-    struct castorder *begin;
-    struct castorder **end;
-  } spellrank;
+    typedef struct spellrank {
+        struct castorder *begin;
+        struct castorder **end;
+    } spellrank;
 
-  struct castorder *create_castorder(struct castorder * co, struct unit *caster, 
+    struct castorder *create_castorder(struct castorder * co, struct unit *caster,
     struct unit * familiar, const struct spell * sp, struct region * r,
-    int lev, float force, int range, struct order * ord, struct spellparameter * p);
-  void free_castorder(struct castorder *co);
-  /* Zwischenspreicher f�r Zauberbefehle, notwendig f�r Priorit�ten */
-  void add_castorder(struct spellrank *cll, struct castorder *co);
-  /* H�nge c-order co an die letze c-order von cll an */
-  void free_castorders(struct castorder *co);
-  /* Speicher wieder freigeben */
+        int lev, float force, int range, struct order * ord, struct spellparameter * p);
+    void free_castorder(struct castorder *co);
+    /* Zwischenspreicher f�r Zauberbefehle, notwendig f�r Priorit�ten */
+    void add_castorder(struct spellrank *cll, struct castorder *co);
+    /* H�nge c-order co an die letze c-order von cll an */
+    void free_castorders(struct castorder *co);
+    /* Speicher wieder freigeben */
 
-/* Pr�froutinen f�r Zaubern */
-  int countspells(struct unit *u, int step);
-  /*      erh�ht den Counter f�r Zauberspr�che um 'step' und gibt die neue
-   *      Anzahl der gezauberten Spr�che zur�ck. */
-  int spellcost(struct unit *u, const struct spell * sp);
-  /*      gibt die f�r diesen Spruch derzeit notwendigen Magiepunkte auf der
-   *      geringstm�glichen Stufe zur�ck, schon um den Faktor der bereits
-   *      zuvor gezauberten Spr�che erh�ht */
-  bool cancast(struct unit *u, const struct spell * spruch, int eff_stufe,
-    int distance, struct order *ord);
-  /*      true, wenn Einheit alle Komponenten des Zaubers (incl. MP) f�r die
-   *      geringstm�gliche Stufe hat und den Spruch beherrscht */
-  void pay_spell(struct unit *u, const struct spell * sp, int eff_stufe, int distance);
-  /*      zieht die Komponenten des Zaubers aus dem Inventory der Einheit
-   *      ab. Die effektive Stufe des gezauberten Spruchs ist wichtig f�r
-   *      die korrekte Bestimmung der Magiepunktkosten */
-  int eff_spelllevel(struct unit *u, const struct spell * sp, int cast_level,
-    int distance);
-  /*      ermittelt die effektive Stufe des Zaubers. Dabei ist cast_level
-   *      die gew�nschte maximale Stufe (im Normalfall Stufe des Magiers,
-   *      bei Farcasting Stufe*2^Entfernung) */
-  bool is_magic_resistant(struct unit *magician, struct unit *target, int
-    resist_bonus);
-  /*      Mapperfunktion f�r target_resists_magic() vom Typ struct unit. */
-  extern double magic_resistance(struct unit *target);
-  /*      gibt die Chance an, mit der einem Zauber widerstanden wird. Je
-   *      gr��er, desto resistenter ist da Opfer */
-  bool target_resists_magic(struct unit *magician, void *obj, int objtyp,
-    int resist_bonus);
-  /*      gibt false zur�ck, wenn der Zauber gelingt, true, wenn das Ziel
-   *      widersteht */
-  extern struct spell * unit_getspell(struct unit *u, const char *s,
-    const struct locale *lang);
+    /* Pr�froutinen f�r Zaubern */
+    int countspells(struct unit *u, int step);
+    /*      erh�ht den Counter f�r Zauberspr�che um 'step' und gibt die neue
+     *      Anzahl der gezauberten Spr�che zur�ck. */
+    int spellcost(struct unit *u, const struct spell * sp);
+    /*      gibt die f�r diesen Spruch derzeit notwendigen Magiepunkte auf der
+     *      geringstm�glichen Stufe zur�ck, schon um den Faktor der bereits
+     *      zuvor gezauberten Spr�che erh�ht */
+    bool cancast(struct unit *u, const struct spell * spruch, int eff_stufe,
+        int distance, struct order *ord);
+    /*      true, wenn Einheit alle Komponenten des Zaubers (incl. MP) f�r die
+     *      geringstm�gliche Stufe hat und den Spruch beherrscht */
+    void pay_spell(struct unit *u, const struct spell * sp, int eff_stufe, int distance);
+    /*      zieht die Komponenten des Zaubers aus dem Inventory der Einheit
+     *      ab. Die effektive Stufe des gezauberten Spruchs ist wichtig f�r
+     *      die korrekte Bestimmung der Magiepunktkosten */
+    int eff_spelllevel(struct unit *u, const struct spell * sp, int cast_level,
+        int distance);
+    /*      ermittelt die effektive Stufe des Zaubers. Dabei ist cast_level
+     *      die gew�nschte maximale Stufe (im Normalfall Stufe des Magiers,
+     *      bei Farcasting Stufe*2^Entfernung) */
+    bool is_magic_resistant(struct unit *magician, struct unit *target, int
+        resist_bonus);
+    /*      Mapperfunktion f�r target_resists_magic() vom Typ struct unit. */
+    extern double magic_resistance(struct unit *target);
+    /*      gibt die Chance an, mit der einem Zauber widerstanden wird. Je
+     *      gr��er, desto resistenter ist da Opfer */
+    bool target_resists_magic(struct unit *magician, void *obj, int objtyp,
+        int resist_bonus);
+    /*      gibt false zur�ck, wenn der Zauber gelingt, true, wenn das Ziel
+     *      widersteht */
+    extern struct spell * unit_getspell(struct unit *u, const char *s,
+        const struct locale *lang);
 
-  /* Spr�che in der struct region */
-  /* (sind in curse) */
-  extern struct unit *get_familiar(const struct unit *u);
-  extern struct unit *get_familiar_mage(const struct unit *u);
-  extern struct unit *get_clone(const struct unit *u);
-  extern struct unit *get_clone_mage(const struct unit *u);
-  extern struct attrib_type at_familiar;
-  extern struct attrib_type at_familiarmage;
-  extern void remove_familiar(struct unit *mage);
-  extern bool create_newfamiliar(struct unit *mage, struct unit *familiar);
-  extern void create_newclone(struct unit *mage, struct unit *familiar);
-  extern struct unit *has_clone(struct unit *mage);
+    /* Spr�che in der struct region */
+    /* (sind in curse) */
+    extern struct unit *get_familiar(const struct unit *u);
+    extern struct unit *get_familiar_mage(const struct unit *u);
+    extern struct unit *get_clone(const struct unit *u);
+    extern struct unit *get_clone_mage(const struct unit *u);
+    extern struct attrib_type at_familiar;
+    extern struct attrib_type at_familiarmage;
+    extern void remove_familiar(struct unit *mage);
+    extern bool create_newfamiliar(struct unit *mage, struct unit *familiar);
+    extern void create_newclone(struct unit *mage, struct unit *familiar);
+    extern struct unit *has_clone(struct unit *mage);
 
-  extern const char *spell_info(const struct spell *sp,
-    const struct locale *lang);
-  extern const char *spell_name(const struct spell *sp,
-    const struct locale *lang);
-  extern const char *curse_name(const struct curse_type *ctype,
-    const struct locale *lang);
+    extern const char *spell_info(const struct spell *sp,
+        const struct locale *lang);
+    extern const char *spell_name(const struct spell *sp,
+        const struct locale *lang);
+    extern const char *curse_name(const struct curse_type *ctype,
+        const struct locale *lang);
 
-  extern struct message *msg_unitnotfound(const struct unit *mage,
+    extern struct message *msg_unitnotfound(const struct unit *mage,
     struct order *ord, const struct spllprm *spobj);
-  extern int FactionSpells(void);
+    extern int FactionSpells(void);
 
-  extern void write_spells(struct quicklist *slist, struct storage *store);
-  extern void read_spells(struct quicklist **slistp, magic_t mtype,
+    extern void write_spells(struct quicklist *slist, struct storage *store);
+    extern void read_spells(struct quicklist **slistp, magic_t mtype,
     struct storage *store);
-  extern float MagicPower(void);
+    extern float MagicPower(void);
 
-  extern struct spellbook * get_spellbook(const char * name);
-  extern void free_spellbooks(void);
+    extern struct spellbook * get_spellbook(const char * name);
+    extern void free_spellbooks(void);
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/magic.test.c b/src/magic.test.c
index a78a16753..9a01d5d4e 100644
--- a/src/magic.test.c
+++ b/src/magic.test.c
@@ -19,382 +19,382 @@
 
 void test_updatespells(CuTest * tc)
 {
-  faction * f;
-  spell * sp;
-  spellbook *book = 0;
+    faction * f;
+    spell * sp;
+    spellbook *book = 0;
 
-  test_cleanup();
-  test_create_race("human");
+    test_cleanup();
+    test_create_race("human");
 
-  f = test_create_faction(0);
-  sp = create_spell("testspell", 0);
-  CuAssertPtrNotNull(tc, sp);
+    f = test_create_faction(0);
+    sp = create_spell("testspell", 0);
+    CuAssertPtrNotNull(tc, sp);
 
-  book = create_spellbook("spells");
-  CuAssertPtrNotNull(tc, book);
-  spellbook_add(book, sp, 1);
+    book = create_spellbook("spells");
+    CuAssertPtrNotNull(tc, book);
+    spellbook_add(book, sp, 1);
 
-  CuAssertPtrEquals(tc, 0, f->spellbook);
-  pick_random_spells(f, 1, book, 1);
-  CuAssertPtrNotNull(tc, f->spellbook);
-  CuAssertIntEquals(tc, 1, ql_length(f->spellbook->spells));
-  CuAssertPtrNotNull(tc, spellbook_get(f->spellbook, sp));
-  test_cleanup();
+    CuAssertPtrEquals(tc, 0, f->spellbook);
+    pick_random_spells(f, 1, book, 1);
+    CuAssertPtrNotNull(tc, f->spellbook);
+    CuAssertIntEquals(tc, 1, ql_length(f->spellbook->spells));
+    CuAssertPtrNotNull(tc, spellbook_get(f->spellbook, sp));
+    test_cleanup();
 }
 
 void test_spellbooks(CuTest * tc)
 {
-  spell *sp;
-  spellbook *herp, *derp;
-  spellbook_entry *entry;
-  const char * sname = "herpderp";
-  test_cleanup();
+    spell *sp;
+    spellbook *herp, *derp;
+    spellbook_entry *entry;
+    const char * sname = "herpderp";
+    test_cleanup();
 
-  herp = get_spellbook("herp");
-  derp = get_spellbook("derp");
-  CuAssertPtrNotNull(tc, herp);
-  CuAssertPtrNotNull(tc, derp);
-  CuAssertTrue(tc, derp!=herp);
-  CuAssertStrEquals(tc, "herp", herp->name);
-  CuAssertStrEquals(tc, "derp", derp->name);
+    herp = get_spellbook("herp");
+    derp = get_spellbook("derp");
+    CuAssertPtrNotNull(tc, herp);
+    CuAssertPtrNotNull(tc, derp);
+    CuAssertTrue(tc, derp != herp);
+    CuAssertStrEquals(tc, "herp", herp->name);
+    CuAssertStrEquals(tc, "derp", derp->name);
 
-  sp = create_spell(sname, 0);
-  spellbook_add(herp, sp, 1);
-  CuAssertPtrNotNull(tc, sp);
-  entry = spellbook_get(herp, sp);
-  CuAssertPtrNotNull(tc, entry);
-  CuAssertPtrEquals(tc, sp, entry->sp);
+    sp = create_spell(sname, 0);
+    spellbook_add(herp, sp, 1);
+    CuAssertPtrNotNull(tc, sp);
+    entry = spellbook_get(herp, sp);
+    CuAssertPtrNotNull(tc, entry);
+    CuAssertPtrEquals(tc, sp, entry->sp);
 
-  test_cleanup();
-  herp = get_spellbook("herp");
-  CuAssertPtrNotNull(tc, herp);
-  test_cleanup();
+    test_cleanup();
+    herp = get_spellbook("herp");
+    CuAssertPtrNotNull(tc, herp);
+    test_cleanup();
 }
 
 static spell * test_magic_create_spell(void)
 {
-  spell *sp;
-  sp = create_spell("testspell", 0);
+    spell *sp;
+    sp = create_spell("testspell", 0);
 
-  sp->components = (spell_component *) calloc(4, sizeof(spell_component));
-  sp->components[0].amount = 1;
-  sp->components[0].type = get_resourcetype(R_SILVER);
-  sp->components[0].cost = SPC_FIX;
-  sp->components[1].amount = 1;
-  sp->components[1].type = get_resourcetype(R_AURA);
-  sp->components[1].cost = SPC_LEVEL;
-  sp->components[2].amount = 1;
-  sp->components[2].type = get_resourcetype(R_HORSE);
-  sp->components[2].cost = SPC_LINEAR;
-  return sp;
+    sp->components = (spell_component *)calloc(4, sizeof(spell_component));
+    sp->components[0].amount = 1;
+    sp->components[0].type = get_resourcetype(R_SILVER);
+    sp->components[0].cost = SPC_FIX;
+    sp->components[1].amount = 1;
+    sp->components[1].type = get_resourcetype(R_AURA);
+    sp->components[1].cost = SPC_LEVEL;
+    sp->components[2].amount = 1;
+    sp->components[2].type = get_resourcetype(R_HORSE);
+    sp->components[2].cost = SPC_LINEAR;
+    return sp;
 }
 
 void test_pay_spell(CuTest * tc)
 {
-  spell *sp;
-  unit * u;
-  faction * f;
-  region * r;
-  int level;
+    spell *sp;
+    unit * u;
+    faction * f;
+    region * r;
+    int level;
 
-  test_cleanup();
-  test_create_world();
-  r = findregion(0, 0);
-  f = test_create_faction(0);
-  u = test_create_unit(f, r);
-  CuAssertPtrNotNull(tc, u);
+    test_cleanup();
+    test_create_world();
+    r = findregion(0, 0);
+    f = test_create_faction(0);
+    u = test_create_unit(f, r);
+    CuAssertPtrNotNull(tc, u);
 
-  sp = test_magic_create_spell();
-  CuAssertPtrNotNull(tc, sp);
+    sp = test_magic_create_spell();
+    CuAssertPtrNotNull(tc, sp);
 
-  set_level(u, SK_MAGIC, 5);
-  unit_add_spell(u, 0, sp, 1);
+    set_level(u, SK_MAGIC, 5);
+    unit_add_spell(u, 0, sp, 1);
 
-  change_resource(u, get_resourcetype(R_SILVER), 1);
-  change_resource(u, get_resourcetype(R_AURA), 3);
-  change_resource(u, get_resourcetype(R_HORSE), 3);
+    change_resource(u, get_resourcetype(R_SILVER), 1);
+    change_resource(u, get_resourcetype(R_AURA), 3);
+    change_resource(u, get_resourcetype(R_HORSE), 3);
 
-  level = eff_spelllevel(u, sp, 3, 1);
-  CuAssertIntEquals(tc, 3, level);
-  pay_spell(u, sp, level, 1);
-  CuAssertIntEquals(tc, 0, get_resource(u, get_resourcetype(R_SILVER)));
-  CuAssertIntEquals(tc, 0, get_resource(u, get_resourcetype(R_AURA)));
-  CuAssertIntEquals(tc, 0, get_resource(u, get_resourcetype(R_HORSE)));
-  test_cleanup();
+    level = eff_spelllevel(u, sp, 3, 1);
+    CuAssertIntEquals(tc, 3, level);
+    pay_spell(u, sp, level, 1);
+    CuAssertIntEquals(tc, 0, get_resource(u, get_resourcetype(R_SILVER)));
+    CuAssertIntEquals(tc, 0, get_resource(u, get_resourcetype(R_AURA)));
+    CuAssertIntEquals(tc, 0, get_resource(u, get_resourcetype(R_HORSE)));
+    test_cleanup();
 }
 
 void test_pay_spell_failure(CuTest * tc)
 {
-  spell *sp;
-  struct unit * u;
-  struct faction * f;
-  struct region * r;
-  int level;
+    spell *sp;
+    struct unit * u;
+    struct faction * f;
+    struct region * r;
+    int level;
 
-  test_cleanup();
-  test_create_world();
-  r = findregion(0, 0);
-  f = test_create_faction(0);
-  u = test_create_unit(f, r);
-  CuAssertPtrNotNull(tc, u);
+    test_cleanup();
+    test_create_world();
+    r = findregion(0, 0);
+    f = test_create_faction(0);
+    u = test_create_unit(f, r);
+    CuAssertPtrNotNull(tc, u);
 
-  sp = test_magic_create_spell();
-  CuAssertPtrNotNull(tc, sp);
+    sp = test_magic_create_spell();
+    CuAssertPtrNotNull(tc, sp);
 
-  set_level(u, SK_MAGIC, 5);
-  unit_add_spell(u, 0, sp, 1);
+    set_level(u, SK_MAGIC, 5);
+    unit_add_spell(u, 0, sp, 1);
 
-  CuAssertIntEquals(tc, 1, change_resource(u, get_resourcetype(R_SILVER), 1));
-  CuAssertIntEquals(tc, 2, change_resource(u, get_resourcetype(R_AURA), 2));
-  CuAssertIntEquals(tc, 3, change_resource(u, get_resourcetype(R_HORSE), 3));
+    CuAssertIntEquals(tc, 1, change_resource(u, get_resourcetype(R_SILVER), 1));
+    CuAssertIntEquals(tc, 2, change_resource(u, get_resourcetype(R_AURA), 2));
+    CuAssertIntEquals(tc, 3, change_resource(u, get_resourcetype(R_HORSE), 3));
 
-  level = eff_spelllevel(u, sp, 3, 1);
-  CuAssertIntEquals(tc, 2, level);
-  pay_spell(u, sp, level, 1);
-  CuAssertIntEquals(tc, 1, change_resource(u, get_resourcetype(R_SILVER), 1));
-  CuAssertIntEquals(tc, 3, change_resource(u, get_resourcetype(R_AURA), 3));
-  CuAssertIntEquals(tc, 2, change_resource(u, get_resourcetype(R_HORSE), 1));
+    level = eff_spelllevel(u, sp, 3, 1);
+    CuAssertIntEquals(tc, 2, level);
+    pay_spell(u, sp, level, 1);
+    CuAssertIntEquals(tc, 1, change_resource(u, get_resourcetype(R_SILVER), 1));
+    CuAssertIntEquals(tc, 3, change_resource(u, get_resourcetype(R_AURA), 3));
+    CuAssertIntEquals(tc, 2, change_resource(u, get_resourcetype(R_HORSE), 1));
 
-  CuAssertIntEquals(tc, 0, eff_spelllevel(u, sp, 3, 1));
-  CuAssertIntEquals(tc, 0, change_resource(u, get_resourcetype(R_SILVER), -1));
-  CuAssertIntEquals(tc, 0, eff_spelllevel(u, sp, 2, 1));
-  test_cleanup();
+    CuAssertIntEquals(tc, 0, eff_spelllevel(u, sp, 3, 1));
+    CuAssertIntEquals(tc, 0, change_resource(u, get_resourcetype(R_SILVER), -1));
+    CuAssertIntEquals(tc, 0, eff_spelllevel(u, sp, 2, 1));
+    test_cleanup();
 }
 
 void test_getspell_unit(CuTest * tc)
 {
-  spell *sp;
-  struct unit * u;
-  struct faction * f;
-  struct region * r;
-  struct locale * lang;
+    spell *sp;
+    struct unit * u;
+    struct faction * f;
+    struct region * r;
+    struct locale * lang;
 
-  test_cleanup();
-  test_create_world();
-  r = findregion(0, 0);
-  f = test_create_faction(0);
-  u = test_create_unit(f, r);
-  create_mage(u, M_GRAY);
-  enable_skill(SK_MAGIC, true);
+    test_cleanup();
+    test_create_world();
+    r = findregion(0, 0);
+    f = test_create_faction(0);
+    u = test_create_unit(f, r);
+    create_mage(u, M_GRAY);
+    enable_skill(SK_MAGIC, true);
 
-  set_level(u, SK_MAGIC, 1);
+    set_level(u, SK_MAGIC, 1);
 
-  lang = get_locale("de");
-  sp = create_spell("testspell", 0);
-  locale_setstring(lang, mkname("spell", sp->sname), "Herp-a-derp");
+    lang = get_locale("de");
+    sp = create_spell("testspell", 0);
+    locale_setstring(lang, mkname("spell", sp->sname), "Herp-a-derp");
 
-  CuAssertPtrEquals(tc, 0, unit_getspell(u, "Herp-a-derp", lang));
+    CuAssertPtrEquals(tc, 0, unit_getspell(u, "Herp-a-derp", lang));
 
-  unit_add_spell(u, 0, sp, 1);
-  CuAssertPtrNotNull(tc, unit_getspell(u, "Herp-a-derp", lang));
-  test_cleanup();
+    unit_add_spell(u, 0, sp, 1);
+    CuAssertPtrNotNull(tc, unit_getspell(u, "Herp-a-derp", lang));
+    test_cleanup();
 }
 
 void test_getspell_faction(CuTest * tc)
 {
-  spell *sp;
-  struct unit * u;
-  struct faction * f;
-  struct region * r;
-  struct locale * lang;
+    spell *sp;
+    struct unit * u;
+    struct faction * f;
+    struct region * r;
+    struct locale * lang;
 
-  test_cleanup();
-  test_create_world();
-  r = findregion(0, 0);
-  f = test_create_faction(0);
-  f->magiegebiet = M_TYBIED;
-  u = test_create_unit(f, r);
-  create_mage(u, f->magiegebiet);
-  enable_skill(SK_MAGIC, true);
+    test_cleanup();
+    test_create_world();
+    r = findregion(0, 0);
+    f = test_create_faction(0);
+    f->magiegebiet = M_TYBIED;
+    u = test_create_unit(f, r);
+    create_mage(u, f->magiegebiet);
+    enable_skill(SK_MAGIC, true);
 
-  set_level(u, SK_MAGIC, 1);
+    set_level(u, SK_MAGIC, 1);
 
-  lang = get_locale("de");
-  sp = create_spell("testspell", 0);
-  locale_setstring(lang, mkname("spell", sp->sname), "Herp-a-derp");
+    lang = get_locale("de");
+    sp = create_spell("testspell", 0);
+    locale_setstring(lang, mkname("spell", sp->sname), "Herp-a-derp");
 
-  CuAssertPtrEquals(tc, 0, unit_getspell(u, "Herp-a-derp", lang));
+    CuAssertPtrEquals(tc, 0, unit_getspell(u, "Herp-a-derp", lang));
 
-  f->spellbook = create_spellbook(0);
-  spellbook_add(f->spellbook, sp, 1);
-  CuAssertPtrEquals(tc, sp, unit_getspell(u, "Herp-a-derp", lang));
-  test_cleanup();
+    f->spellbook = create_spellbook(0);
+    spellbook_add(f->spellbook, sp, 1);
+    CuAssertPtrEquals(tc, sp, unit_getspell(u, "Herp-a-derp", lang));
+    test_cleanup();
 }
 
 void test_getspell_school(CuTest * tc)
 {
-  spell *sp;
-  struct unit * u;
-  struct faction * f;
-  struct region * r;
-  struct locale * lang;
-  struct spellbook * book;
+    spell *sp;
+    struct unit * u;
+    struct faction * f;
+    struct region * r;
+    struct locale * lang;
+    struct spellbook * book;
 
-  test_cleanup();
-  test_create_world();
-  r = findregion(0, 0);
-  f = test_create_faction(0);
-  f->magiegebiet = M_TYBIED;
-  u = test_create_unit(f, r);
-  create_mage(u, f->magiegebiet);
-  enable_skill(SK_MAGIC, true);
-  set_level(u, SK_MAGIC, 1);
+    test_cleanup();
+    test_create_world();
+    r = findregion(0, 0);
+    f = test_create_faction(0);
+    f->magiegebiet = M_TYBIED;
+    u = test_create_unit(f, r);
+    create_mage(u, f->magiegebiet);
+    enable_skill(SK_MAGIC, true);
+    set_level(u, SK_MAGIC, 1);
 
-  lang = get_locale("de");
-  sp = create_spell("testspell", 0);
-  locale_setstring(lang, mkname("spell", sp->sname), "Herp-a-derp");
+    lang = get_locale("de");
+    sp = create_spell("testspell", 0);
+    locale_setstring(lang, mkname("spell", sp->sname), "Herp-a-derp");
 
-  CuAssertPtrEquals(tc, 0, unit_getspell(u, "Herp-a-derp", lang));
+    CuAssertPtrEquals(tc, 0, unit_getspell(u, "Herp-a-derp", lang));
 
-  book = faction_get_spellbook(f);
-  CuAssertPtrNotNull(tc, book);
-  spellbook_add(book, sp, 1);
-  CuAssertPtrEquals(tc, sp, unit_getspell(u, "Herp-a-derp", lang));
-  test_cleanup();
+    book = faction_get_spellbook(f);
+    CuAssertPtrNotNull(tc, book);
+    spellbook_add(book, sp, 1);
+    CuAssertPtrEquals(tc, sp, unit_getspell(u, "Herp-a-derp", lang));
+    test_cleanup();
 }
 
 void test_set_pre_combatspell(CuTest * tc)
 {
-  spell *sp;
-  struct unit * u;
-  struct faction * f;
-  struct region * r;
-  const int index = 0;
+    spell *sp;
+    struct unit * u;
+    struct faction * f;
+    struct region * r;
+    const int index = 0;
 
-  test_cleanup();
-  test_create_world();
-  r = findregion(0, 0);
-  f = test_create_faction(0);
-  f->magiegebiet = M_TYBIED;
-  u = test_create_unit(f, r);
-  enable_skill(SK_MAGIC, true);
-  set_level(u, SK_MAGIC, 1);
-  sp = create_spell("testspell", 0);
-  sp->sptyp |= PRECOMBATSPELL;
+    test_cleanup();
+    test_create_world();
+    r = findregion(0, 0);
+    f = test_create_faction(0);
+    f->magiegebiet = M_TYBIED;
+    u = test_create_unit(f, r);
+    enable_skill(SK_MAGIC, true);
+    set_level(u, SK_MAGIC, 1);
+    sp = create_spell("testspell", 0);
+    sp->sptyp |= PRECOMBATSPELL;
 
-  unit_add_spell(u, 0, sp, 1);
+    unit_add_spell(u, 0, sp, 1);
 
-  set_combatspell(u, sp, 0, 2);
-  CuAssertPtrEquals(tc, sp, (spell *)get_combatspell(u, index));
-  set_level(u, SK_MAGIC, 2);
-  CuAssertIntEquals(tc, 2, get_combatspelllevel(u, index));
-  set_level(u, SK_MAGIC, 1);
-  CuAssertIntEquals(tc, 1, get_combatspelllevel(u, index));
-  unset_combatspell(u, sp);
-  CuAssertIntEquals(tc, 0, get_combatspelllevel(u, index));
-  CuAssertPtrEquals(tc, 0, (spell *)get_combatspell(u, index));
-  test_cleanup();
+    set_combatspell(u, sp, 0, 2);
+    CuAssertPtrEquals(tc, sp, (spell *)get_combatspell(u, index));
+    set_level(u, SK_MAGIC, 2);
+    CuAssertIntEquals(tc, 2, get_combatspelllevel(u, index));
+    set_level(u, SK_MAGIC, 1);
+    CuAssertIntEquals(tc, 1, get_combatspelllevel(u, index));
+    unset_combatspell(u, sp);
+    CuAssertIntEquals(tc, 0, get_combatspelllevel(u, index));
+    CuAssertPtrEquals(tc, 0, (spell *)get_combatspell(u, index));
+    test_cleanup();
 }
 
 void test_set_main_combatspell(CuTest * tc)
 {
-  spell *sp;
-  struct unit * u;
-  struct faction * f;
-  struct region * r;
-  const int index = 1;
+    spell *sp;
+    struct unit * u;
+    struct faction * f;
+    struct region * r;
+    const int index = 1;
 
-  test_cleanup();
-  test_create_world();
-  r = findregion(0, 0);
-  f = test_create_faction(0);
-  f->magiegebiet = M_TYBIED;
-  u = test_create_unit(f, r);
-  enable_skill(SK_MAGIC, true);
-  set_level(u, SK_MAGIC, 1);
-  sp = create_spell("testspell", 0);
-  sp->sptyp |= COMBATSPELL;
+    test_cleanup();
+    test_create_world();
+    r = findregion(0, 0);
+    f = test_create_faction(0);
+    f->magiegebiet = M_TYBIED;
+    u = test_create_unit(f, r);
+    enable_skill(SK_MAGIC, true);
+    set_level(u, SK_MAGIC, 1);
+    sp = create_spell("testspell", 0);
+    sp->sptyp |= COMBATSPELL;
 
-  unit_add_spell(u, 0, sp, 1);
+    unit_add_spell(u, 0, sp, 1);
 
-  set_combatspell(u, sp, 0, 2);
-  CuAssertPtrEquals(tc, sp, (spell *)get_combatspell(u, index));
-  set_level(u, SK_MAGIC, 2);
-  CuAssertIntEquals(tc, 2, get_combatspelllevel(u, index));
-  set_level(u, SK_MAGIC, 1);
-  CuAssertIntEquals(tc, 1, get_combatspelllevel(u, index));
-  unset_combatspell(u, sp);
-  CuAssertIntEquals(tc, 0, get_combatspelllevel(u, index));
-  CuAssertPtrEquals(tc, 0, (spell *)get_combatspell(u, index));
-  test_cleanup();
+    set_combatspell(u, sp, 0, 2);
+    CuAssertPtrEquals(tc, sp, (spell *)get_combatspell(u, index));
+    set_level(u, SK_MAGIC, 2);
+    CuAssertIntEquals(tc, 2, get_combatspelllevel(u, index));
+    set_level(u, SK_MAGIC, 1);
+    CuAssertIntEquals(tc, 1, get_combatspelllevel(u, index));
+    unset_combatspell(u, sp);
+    CuAssertIntEquals(tc, 0, get_combatspelllevel(u, index));
+    CuAssertPtrEquals(tc, 0, (spell *)get_combatspell(u, index));
+    test_cleanup();
 }
 
 void test_set_post_combatspell(CuTest * tc)
 {
-  spell *sp;
-  struct unit * u;
-  struct faction * f;
-  struct region * r;
-  const int index = 2;
+    spell *sp;
+    struct unit * u;
+    struct faction * f;
+    struct region * r;
+    const int index = 2;
 
-  test_cleanup();
-  test_create_world();
-  r = findregion(0, 0);
-  f = test_create_faction(0);
-  f->magiegebiet = M_TYBIED;
-  u = test_create_unit(f, r);
-  enable_skill(SK_MAGIC, true);
-  set_level(u, SK_MAGIC, 1);
-  sp = create_spell("testspell", 0);
-  sp->sptyp |= POSTCOMBATSPELL;
+    test_cleanup();
+    test_create_world();
+    r = findregion(0, 0);
+    f = test_create_faction(0);
+    f->magiegebiet = M_TYBIED;
+    u = test_create_unit(f, r);
+    enable_skill(SK_MAGIC, true);
+    set_level(u, SK_MAGIC, 1);
+    sp = create_spell("testspell", 0);
+    sp->sptyp |= POSTCOMBATSPELL;
 
-  unit_add_spell(u, 0, sp, 1);
+    unit_add_spell(u, 0, sp, 1);
 
-  set_combatspell(u, sp, 0, 2);
-  CuAssertPtrEquals(tc, sp, (spell *)get_combatspell(u, index));
-  set_level(u, SK_MAGIC, 2);
-  CuAssertIntEquals(tc, 2, get_combatspelllevel(u, index));
-  set_level(u, SK_MAGIC, 1);
-  CuAssertIntEquals(tc, 1, get_combatspelllevel(u, index));
-  unset_combatspell(u, sp);
-  CuAssertIntEquals(tc, 0, get_combatspelllevel(u, index));
-  CuAssertPtrEquals(tc, 0, (spell *)get_combatspell(u, index));
-  test_cleanup();
+    set_combatspell(u, sp, 0, 2);
+    CuAssertPtrEquals(tc, sp, (spell *)get_combatspell(u, index));
+    set_level(u, SK_MAGIC, 2);
+    CuAssertIntEquals(tc, 2, get_combatspelllevel(u, index));
+    set_level(u, SK_MAGIC, 1);
+    CuAssertIntEquals(tc, 1, get_combatspelllevel(u, index));
+    unset_combatspell(u, sp);
+    CuAssertIntEquals(tc, 0, get_combatspelllevel(u, index));
+    CuAssertPtrEquals(tc, 0, (spell *)get_combatspell(u, index));
+    test_cleanup();
 }
 
 void test_hasspell(CuTest * tc)
 {
-  spell *sp;
-  struct unit * u;
-  struct faction * f;
-  struct region * r;
+    spell *sp;
+    struct unit * u;
+    struct faction * f;
+    struct region * r;
 
-  test_cleanup();
-  test_create_world();
-  r = findregion(0, 0);
-  f = test_create_faction(0);
-  f->magiegebiet = M_TYBIED;
-  u = test_create_unit(f, r);
-  enable_skill(SK_MAGIC, true);
-  sp = create_spell("testspell", 0);
-  sp->sptyp |= POSTCOMBATSPELL;
+    test_cleanup();
+    test_create_world();
+    r = findregion(0, 0);
+    f = test_create_faction(0);
+    f->magiegebiet = M_TYBIED;
+    u = test_create_unit(f, r);
+    enable_skill(SK_MAGIC, true);
+    sp = create_spell("testspell", 0);
+    sp->sptyp |= POSTCOMBATSPELL;
 
-  unit_add_spell(u, 0, sp, 2);
+    unit_add_spell(u, 0, sp, 2);
 
-  set_level(u, SK_MAGIC, 1);
-  CuAssertTrue(tc, !u_hasspell(u, sp));
+    set_level(u, SK_MAGIC, 1);
+    CuAssertTrue(tc, !u_hasspell(u, sp));
 
-  set_level(u, SK_MAGIC, 2);
-  CuAssertTrue(tc, u_hasspell(u, sp));
+    set_level(u, SK_MAGIC, 2);
+    CuAssertTrue(tc, u_hasspell(u, sp));
 
-  set_level(u, SK_MAGIC, 1);
-  CuAssertTrue(tc, !u_hasspell(u, sp));
-  test_cleanup();
+    set_level(u, SK_MAGIC, 1);
+    CuAssertTrue(tc, !u_hasspell(u, sp));
+    test_cleanup();
 }
 
 CuSuite *get_magic_suite(void)
 {
-  CuSuite *suite = CuSuiteNew();
-  SUITE_ADD_TEST(suite, test_updatespells);
-  SUITE_ADD_TEST(suite, test_spellbooks);
-  SUITE_ADD_TEST(suite, test_pay_spell);
-  SUITE_ADD_TEST(suite, test_pay_spell_failure);
-  SUITE_ADD_TEST(suite, test_getspell_unit);
-  SUITE_ADD_TEST(suite, test_getspell_faction);
-  SUITE_ADD_TEST(suite, test_getspell_school);
-  SUITE_ADD_TEST(suite, test_set_pre_combatspell);
-  SUITE_ADD_TEST(suite, test_set_main_combatspell);
-  SUITE_ADD_TEST(suite, test_set_post_combatspell);
-  SUITE_ADD_TEST(suite, test_hasspell);
-  return suite;
+    CuSuite *suite = CuSuiteNew();
+    SUITE_ADD_TEST(suite, test_updatespells);
+    SUITE_ADD_TEST(suite, test_spellbooks);
+    SUITE_ADD_TEST(suite, test_pay_spell);
+    SUITE_ADD_TEST(suite, test_pay_spell_failure);
+    SUITE_ADD_TEST(suite, test_getspell_unit);
+    SUITE_ADD_TEST(suite, test_getspell_faction);
+    SUITE_ADD_TEST(suite, test_getspell_school);
+    SUITE_ADD_TEST(suite, test_set_pre_combatspell);
+    SUITE_ADD_TEST(suite, test_set_main_combatspell);
+    SUITE_ADD_TEST(suite, test_set_post_combatspell);
+    SUITE_ADD_TEST(suite, test_hasspell);
+    return suite;
 }
diff --git a/src/main.c b/src/main.c
index 316c3c206..dcd9b383e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/market.c b/src/market.c
index d860079cb..a4158e48d 100644
--- a/src/market.c
+++ b/src/market.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/*
 +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -6,7 +6,7 @@
 |                   |  Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
 +-------------------+  Stefan Reich <reich@halbling.de>
 
-This program may not be used, modified or distributed 
+This program may not be used, modified or distributed
 without prior permission by the authors of Eressea.
 
 */
@@ -30,56 +30,56 @@ without prior permission by the authors of Eressea.
 
 static unsigned int get_markets(region * r, unit ** results, size_t size)
 {
-  unsigned int n = 0;
-  building *b;
-  const building_type *btype = bt_find("market");
-  if (!btype)
+    unsigned int n = 0;
+    building *b;
+    const building_type *btype = bt_find("market");
+    if (!btype)
         return 0;
-  for (b = r->buildings; n < size && b; b = b->next) {
-    if (b->type == btype && (b->flags & BLD_WORKING)
-      && b->size >= b->type->maxsize) {
-      unit *u = building_owner(b);
-      unsigned int i;
-      for (i = 0; u && i != n; ++i) {
-        /* only one market per faction */
-        if (results[i]->faction == u->faction)
-          u = NULL;
-      }
-      if (u) {
-        results[n++] = u;
-      }
+    for (b = r->buildings; n < size && b; b = b->next) {
+        if (b->type == btype && (b->flags & BLD_WORKING)
+            && b->size >= b->type->maxsize) {
+            unit *u = building_owner(b);
+            unsigned int i;
+            for (i = 0; u && i != n; ++i) {
+                /* only one market per faction */
+                if (results[i]->faction == u->faction)
+                    u = NULL;
+            }
+            if (u) {
+                results[n++] = u;
+            }
+        }
     }
-  }
-  return n;
+    return n;
 }
 
 static void free_market(attrib * a)
 {
-  item *items = (item *) a->data.v;
-  i_freeall(&items);
-  a->data.v = 0;
+    item *items = (item *)a->data.v;
+    i_freeall(&items);
+    a->data.v = 0;
 }
 
 attrib_type at_market = {
-  "script",
-  NULL, free_market, NULL,
-  NULL, NULL, ATF_UNIQUE
+    "script",
+    NULL, free_market, NULL,
+    NULL, NULL, ATF_UNIQUE
 };
 
 static int rc_luxury_trade(const struct race *rc)
 {
-  if (rc) {
-    return get_param_int(rc->parameters, "luxury_trade", 1000);
-  }
-  return 1000;
+    if (rc) {
+        return get_param_int(rc->parameters, "luxury_trade", 1000);
+    }
+    return 1000;
 }
 
 static int rc_herb_trade(const struct race *rc)
 {
-  if (rc) {
-    return get_param_int(rc->parameters, "herb_trade", 500);
-  }
-  return 500;
+    if (rc) {
+        return get_param_int(rc->parameters, "herb_trade", 500);
+    }
+    return 500;
 }
 
 #define MAX_MARKETS 128
@@ -87,89 +87,90 @@ static int rc_herb_trade(const struct race *rc)
 
 void do_markets(void)
 {
-  quicklist *traders = 0;
-  unit *markets[MAX_MARKETS];
-  region *r;
-  for (r = regions; r; r = r->next) {
-    if (r->land) {
-      faction *f = region_get_owner(r);
-      const struct race *rc = f ? f->race : NULL;
-      int p = rpeasants(r);
-      int numlux = rc_luxury_trade(rc), numherbs = rc_herb_trade(rc);
-      numlux = (p + numlux - MIN_PEASANTS) / numlux;
-      numherbs = (p + numherbs - MIN_PEASANTS) / numherbs;
-      if (numlux > 0 || numherbs > 0) {
-        int d, nmarkets = 0;
-        const item_type *lux = r_luxury(r);
-        const item_type *herb = r->land->herbtype;
+    quicklist *traders = 0;
+    unit *markets[MAX_MARKETS];
+    region *r;
+    for (r = regions; r; r = r->next) {
+        if (r->land) {
+            faction *f = region_get_owner(r);
+            const struct race *rc = f ? f->race : NULL;
+            int p = rpeasants(r);
+            int numlux = rc_luxury_trade(rc), numherbs = rc_herb_trade(rc);
+            numlux = (p + numlux - MIN_PEASANTS) / numlux;
+            numherbs = (p + numherbs - MIN_PEASANTS) / numherbs;
+            if (numlux > 0 || numherbs > 0) {
+                int d, nmarkets = 0;
+                const item_type *lux = r_luxury(r);
+                const item_type *herb = r->land->herbtype;
 
-        nmarkets += get_markets(r, markets + nmarkets, MAX_MARKETS - nmarkets);
-        for (d = 0; d != MAXDIRECTIONS; ++d) {
-          region *r2 = rconnect(r, d);
-          if (r2 && r2->buildings) {
-            nmarkets +=
-              get_markets(r2, markets + nmarkets, MAX_MARKETS - nmarkets);
-          }
-        }
-        if (nmarkets) {
-          while (lux && numlux--) {
-            int n = rng_int() % nmarkets;
-            unit *u = markets[n];
-            item *items;
-            attrib *a = a_find(u->attribs, &at_market);
-            if (a == NULL) {
-              a = a_add(&u->attribs, a_new(&at_market));
-              ql_push(&traders, u);
+                nmarkets += get_markets(r, markets + nmarkets, MAX_MARKETS - nmarkets);
+                for (d = 0; d != MAXDIRECTIONS; ++d) {
+                    region *r2 = rconnect(r, d);
+                    if (r2 && r2->buildings) {
+                        nmarkets +=
+                            get_markets(r2, markets + nmarkets, MAX_MARKETS - nmarkets);
+                    }
+                }
+                if (nmarkets) {
+                    while (lux && numlux--) {
+                        int n = rng_int() % nmarkets;
+                        unit *u = markets[n];
+                        item *items;
+                        attrib *a = a_find(u->attribs, &at_market);
+                        if (a == NULL) {
+                            a = a_add(&u->attribs, a_new(&at_market));
+                            ql_push(&traders, u);
+                        }
+                        items = (item *)a->data.v;
+                        i_change(&items, lux, 1);
+                        a->data.v = items;
+                        /* give 1 luxury */
+                    }
+                    while (herb && numherbs--) {
+                        int n = rng_int() % nmarkets;
+                        unit *u = markets[n];
+                        item *items;
+                        attrib *a = a_find(u->attribs, &at_market);
+                        if (a == NULL) {
+                            a = a_add(&u->attribs, a_new(&at_market));
+                            ql_push(&traders, u);
+                        }
+                        items = (item *)a->data.v;
+                        i_change(&items, herb, 1);
+                        a->data.v = items;
+                        /* give 1 herb */
+                    }
+                }
             }
-            items = (item *) a->data.v;
-            i_change(&items, lux, 1);
-            a->data.v = items;
-            /* give 1 luxury */
-          }
-          while (herb && numherbs--) {
-            int n = rng_int() % nmarkets;
-            unit *u = markets[n];
-            item *items;
+        }
+    }
+
+    if (traders) {
+        quicklist *qliter = traders;
+        int qli = 0;
+        for (qli = 0; qliter; ql_advance(&qliter, &qli, 1)) {
+            unit *u = (unit *)ql_get(qliter, qli);
             attrib *a = a_find(u->attribs, &at_market);
-            if (a == NULL) {
-              a = a_add(&u->attribs, a_new(&at_market));
-              ql_push(&traders, u);
+            item *items = (item *)a->data.v;
+
+            a->data.v = NULL;
+            while (items) {
+                item *itm = items;
+                items = itm->next;
+
+                if (itm->number) {
+                    ADDMSG(&u->faction->msgs, msg_message("buyamount",
+                        "unit amount resource", u, itm->number, itm->type->rtype));
+                    itm->next = NULL;
+                    i_add(&u->items, itm);
+                }
+                else {
+                    i_free(itm);
+                }
             }
-            items = (item *) a->data.v;
-            i_change(&items, herb, 1);
-            a->data.v = items;
-            /* give 1 herb */
-          }
+
+            a_remove(&u->attribs, a);
         }
-      }
+        ql_free(traders);
     }
-  }
-
-  if (traders) {
-    quicklist *qliter = traders;
-    int qli = 0;
-    for (qli = 0; qliter; ql_advance(&qliter, &qli, 1)) {
-      unit *u = (unit *) ql_get(qliter, qli);
-      attrib *a = a_find(u->attribs, &at_market);
-      item *items = (item *) a->data.v;
-
-      a->data.v = NULL;
-      while (items) {
-        item *itm = items;
-        items = itm->next;
-
-        if (itm->number) {
-          ADDMSG(&u->faction->msgs, msg_message("buyamount",
-              "unit amount resource", u, itm->number, itm->type->rtype));
-          itm->next = NULL;
-          i_add(&u->items, itm);
-        } else {
-          i_free(itm);
-        }
-      }
-
-      a_remove(&u->attribs, a);
-    }
-    ql_free(traders);
-  }
 }
diff --git a/src/market.h b/src/market.h
index e45fbb7a1..dd15253ef 100644
--- a/src/market.h
+++ b/src/market.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/*
 +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -6,7 +6,7 @@
 |                   |  Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
 +-------------------+  Stefan Reich <reich@halbling.de>
 
-This program may not be used, modified or distributed 
+This program may not be used, modified or distributed
 without prior permission by the authors of Eressea.
 
 */
@@ -15,9 +15,9 @@ without prior permission by the authors of Eressea.
 #ifdef __cplusplus
 extern "C" {
 #endif
-  struct building;
+    struct building;
 
-  extern void do_markets(void);
+    extern void do_markets(void);
 
 #ifdef __cplusplus
 }
diff --git a/src/market.test.c b/src/market.test.c
index 781577ff0..12c9cab3f 100644
--- a/src/market.test.c
+++ b/src/market.test.c
@@ -21,67 +21,68 @@
 
 static void test_market_curse(CuTest * tc)
 {
-  region *r;
-  building *b;
-  unit *u;
-  faction *f;
-  int x, y;
-  const terrain_type *terrain;
-  item_type *htype, *ltype;
-  luxury_type *lux;
-  building_type *btype;
+    region *r;
+    building *b;
+    unit *u;
+    faction *f;
+    int x, y;
+    const terrain_type *terrain;
+    item_type *htype, *ltype;
+    luxury_type *lux;
+    building_type *btype;
 
-  free_gamedata();
-  test_cleanup();
-  test_create_world();
+    free_gamedata();
+    test_cleanup();
+    test_create_world();
 
-  htype = test_create_itemtype("herb");
-  htype->flags |= ITF_HERB;
-  htype->rtype->flags |= (RTF_ITEM | RTF_POOLED);
+    htype = test_create_itemtype("herb");
+    htype->flags |= ITF_HERB;
+    htype->rtype->flags |= (RTF_ITEM | RTF_POOLED);
 
-  ltype = test_create_itemtype("balm");
-  ltype->rtype->flags |= (RTF_ITEM | RTF_POOLED);
-  lux = new_luxurytype(ltype, 0);
+    ltype = test_create_itemtype("balm");
+    ltype->rtype->flags |= (RTF_ITEM | RTF_POOLED);
+    lux = new_luxurytype(ltype, 0);
 
-  set_param(&global.parameters, "rules.region_owners", "1");
+    set_param(&global.parameters, "rules.region_owners", "1");
 
-  btype = (building_type *)calloc(1, sizeof(building_type));
-  btype->_name = _strdup("market");
-  bt_register(btype);
+    btype = (building_type *)calloc(1, sizeof(building_type));
+    btype->_name = _strdup("market");
+    bt_register(btype);
 
-  terrain = get_terrain("plain");
+    terrain = get_terrain("plain");
 
-  for (x = 0; x != 3; ++x) {
-    for (y = 0; y != 3; ++y) {
-      r = findregion(x, y);
-      if (!r) {
-        r = test_create_region(x, y, terrain);
-      } else {
-        terraform_region(r, terrain);
-      }
-      rsetpeasants(r, 5000);
-      r_setdemand(r, lux, 0);
-      rsetherbtype(r, htype);
+    for (x = 0; x != 3; ++x) {
+        for (y = 0; y != 3; ++y) {
+            r = findregion(x, y);
+            if (!r) {
+                r = test_create_region(x, y, terrain);
+            }
+            else {
+                terraform_region(r, terrain);
+            }
+            rsetpeasants(r, 5000);
+            r_setdemand(r, lux, 0);
+            rsetherbtype(r, htype);
+        }
     }
-  }
-  r = findregion(1, 1);
-  b = test_create_building(r, btype);
-  b->flags |= BLD_WORKING;
-  b->size = b->type->maxsize;
+    r = findregion(1, 1);
+    b = test_create_building(r, btype);
+    b->flags |= BLD_WORKING;
+    b->size = b->type->maxsize;
 
-  f = test_create_faction(0);
-  u = test_create_unit(f, r);
-  u_set_building(u, b);
+    f = test_create_faction(0);
+    u = test_create_unit(f, r);
+    u_set_building(u, b);
 
-  do_markets();
+    do_markets();
 
-  CuAssertIntEquals(tc, 70, i_get(u->items, htype));
-  CuAssertIntEquals(tc, 35, i_get(u->items, ltype));
+    CuAssertIntEquals(tc, 70, i_get(u->items, htype));
+    CuAssertIntEquals(tc, 35, i_get(u->items, ltype));
 }
 
 CuSuite *get_market_suite(void)
 {
-  CuSuite *suite = CuSuiteNew();
-  SUITE_ADD_TEST(suite, test_market_curse);
-  return suite;
+    CuSuite *suite = CuSuiteNew();
+    SUITE_ADD_TEST(suite, test_market_curse);
+    return suite;
 }
diff --git a/src/modules/arena.c b/src/modules/arena.c
index 1ce4763a5..975af9520 100644
--- a/src/modules/arena.c
+++ b/src/modules/arena.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -78,29 +78,29 @@ static region *start_region[6];
 
 static region *arena_region(int school)
 {
-  return tower_region[school];
+    return tower_region[school];
 }
 
 static building *arena_tower(int school)
 {
-  return arena_region(school)->buildings;
+    return arena_region(school)->buildings;
 }
 
 static int leave_fail(unit * u)
 {
-  ADDMSG(&u->faction->msgs, msg_message("arena_leave_fail", "unit", u));
-  return 1;
+    ADDMSG(&u->faction->msgs, msg_message("arena_leave_fail", "unit", u));
+    return 1;
 }
 
 static int
 leave_arena(struct unit *u, const struct item_type *itype, int amount,
-  order * ord)
+order * ord)
 {
     if (!u->building && leave_fail(u)) {
         return -1;
     }
     if (u->building != arena_tower(u->faction->magiegebiet) && leave_fail(u)) {
-       return -1;
+        return -1;
     }
     unused_arg(amount);
     unused_arg(ord);
@@ -111,65 +111,65 @@ leave_arena(struct unit *u, const struct item_type *itype, int amount,
 
 static int enter_fail(unit * u)
 {
-  ADDMSG(&u->faction->msgs, msg_message("arena_enter_fail", "region unit",
-      u->region, u));
-  return 1;
+    ADDMSG(&u->faction->msgs, msg_message("arena_enter_fail", "region unit",
+        u->region, u));
+    return 1;
 }
 
 static int
 enter_arena(unit * u, const item_type * itype, int amount, order * ord)
 {
-  skill_t sk;
-  region *r = u->region;
-  unit *u2;
-  int fee = u->faction->score / 5;
-  unused_arg(ord);
-  unused_arg(amount);
-  unused_arg(itype);
-  if (fee > 2000)
-    fee = 2000;
-  if (getplane(r) == arena)
-    return -1;
-  if (u->number != 1 && enter_fail(u))
-    return -1;
-  if (get_pooled(u, get_resourcetype(R_SILVER), GET_DEFAULT, fee) < fee
-    && enter_fail(u))
-    return -1;
-  for (sk = 0; sk != MAXSKILLS; ++sk) {
-    if (get_level(u, sk) > 1 && enter_fail(u))
-      return -1;
-  }
-  for (u2 = r->units; u2; u2 = u2->next)
-    if (u2->faction == u->faction)
-      break;
+    skill_t sk;
+    region *r = u->region;
+    unit *u2;
+    int fee = u->faction->score / 5;
+    unused_arg(ord);
+    unused_arg(amount);
+    unused_arg(itype);
+    if (fee > 2000)
+        fee = 2000;
+    if (getplane(r) == arena)
+        return -1;
+    if (u->number != 1 && enter_fail(u))
+        return -1;
+    if (get_pooled(u, get_resourcetype(R_SILVER), GET_DEFAULT, fee) < fee
+        && enter_fail(u))
+        return -1;
+    for (sk = 0; sk != MAXSKILLS; ++sk) {
+        if (get_level(u, sk) > 1 && enter_fail(u))
+            return -1;
+    }
+    for (u2 = r->units; u2; u2 = u2->next)
+        if (u2->faction == u->faction)
+            break;
 
-  assert(!"not implemented");
-/*
-	for (res=0;res!=MAXRESOURCES;++res) if (res!=R_SILVER && res!=R_ARENA_GATE && (is_item(res) || is_herb(res) || is_potion(res))) {
-		int x = get_resource(u, res);
-		if (x) {
-			if (u2) {
-				change_resource(u2, res, x);
-				change_resource(u, res, -x);
-			}
-			else if (enter_fail(u)) return -1;
-		}
-	}
-*/
-  if (get_money(u) > fee) {
-    if (u2)
-      change_money(u2, get_money(u) - fee);
-    else if (enter_fail(u))
-      return -1;
-  }
-  ADDMSG(&u->faction->msgs, msg_message("arena_enter_fail", "region unit",
-      u->region, u));
-  use_pooled(u, itype->rtype, GET_SLACK | GET_RESERVE, 1);
-  use_pooled(u, get_resourcetype(R_SILVER), GET_DEFAULT, fee);
-  set_money(u, 109);
-  fset(u, UFL_ANON_FACTION);
-  move_unit(u, start_region[rng_int() % 6], NULL);
-  return 0;
+    assert(!"not implemented");
+    /*
+            for (res=0;res!=MAXRESOURCES;++res) if (res!=R_SILVER && res!=R_ARENA_GATE && (is_item(res) || is_herb(res) || is_potion(res))) {
+            int x = get_resource(u, res);
+            if (x) {
+            if (u2) {
+            change_resource(u2, res, x);
+            change_resource(u, res, -x);
+            }
+            else if (enter_fail(u)) return -1;
+            }
+            }
+            */
+    if (get_money(u) > fee) {
+        if (u2)
+            change_money(u2, get_money(u) - fee);
+        else if (enter_fail(u))
+            return -1;
+    }
+    ADDMSG(&u->faction->msgs, msg_message("arena_enter_fail", "region unit",
+        u->region, u));
+    use_pooled(u, itype->rtype, GET_SLACK | GET_RESERVE, 1);
+    use_pooled(u, get_resourcetype(R_SILVER), GET_DEFAULT, fee);
+    set_money(u, 109);
+    fset(u, UFL_ANON_FACTION);
+    move_unit(u, start_region[rng_int() % 6], NULL);
+    return 0;
 }
 
 /***
@@ -178,27 +178,27 @@ enter_arena(unit * u, const item_type * itype, int amount, order * ord)
 
 static int
 use_wand_of_tears(unit * user, const struct item_type *itype, int amount,
-  order * ord)
+order * ord)
 {
-  int n;
-  unused_arg(ord);
-  for (n = 0; n != amount; ++n) {
-    unit *u;
-    for (u = user->region->units; u; u = u->next) {
-      if (u->faction != user->faction) {
-        int i;
+    int n;
+    unused_arg(ord);
+    for (n = 0; n != amount; ++n) {
+        unit *u;
+        for (u = user->region->units; u; u = u->next) {
+            if (u->faction != user->faction) {
+                int i;
 
-        for (i = 0; i != u->skill_size; ++i) {
-          if (rng_int() % 3)
-            reduce_skill(u, u->skills + i, 1);
+                for (i = 0; i != u->skill_size; ++i) {
+                    if (rng_int() % 3)
+                        reduce_skill(u, u->skills + i, 1);
+                }
+                ADDMSG(&u->faction->msgs, msg_message("wand_of_tears_effect",
+                    "unit", u));
+            }
         }
-        ADDMSG(&u->faction->msgs, msg_message("wand_of_tears_effect",
-            "unit", u));
-      }
     }
-  }
-  ADDMSG(&user->region->msgs, msg_message("wand_of_tears_usage", "unit", user));
-  return 0;
+    ADDMSG(&user->region->msgs, msg_message("wand_of_tears_usage", "unit", user));
+    return 0;
 }
 
 /**
@@ -206,78 +206,78 @@ use_wand_of_tears(unit * user, const struct item_type *itype, int amount,
 
 static int age_hurting(attrib * a)
 {
-  building *b = (building *) a->data.v;
-  unit *u;
-  int active = 0;
-  if (b == NULL)
-    return AT_AGE_REMOVE;
-  for (u = b->region->units; u; u = u->next) {
-    if (u->building == b) {
-      if (u->faction->magiegebiet == M_DRAIG) {
-        active++;
-        ADDMSG(&b->region->msgs, msg_message("praytoigjarjuk", "unit", u));
-      }
-    }
-  }
-  if (active)
-    for (u = b->region->units; u; u = u->next)
-      if (playerrace(u->faction->race)) {
-        int i;
-        if (u->faction->magiegebiet != M_DRAIG) {
-          for (i = 0; i != active; ++i)
-            u->hp = (u->hp + 1) / 2;    /* make them suffer, but not die */
-          ADDMSG(&b->region->msgs, msg_message("cryinpain", "unit", u));
+    building *b = (building *)a->data.v;
+    unit *u;
+    int active = 0;
+    if (b == NULL)
+        return AT_AGE_REMOVE;
+    for (u = b->region->units; u; u = u->next) {
+        if (u->building == b) {
+            if (u->faction->magiegebiet == M_DRAIG) {
+                active++;
+                ADDMSG(&b->region->msgs, msg_message("praytoigjarjuk", "unit", u));
+            }
         }
-      }
-  return AT_AGE_KEEP;
+    }
+    if (active)
+        for (u = b->region->units; u; u = u->next)
+            if (playerrace(u->faction->race)) {
+                int i;
+                if (u->faction->magiegebiet != M_DRAIG) {
+                    for (i = 0; i != active; ++i)
+                        u->hp = (u->hp + 1) / 2;    /* make them suffer, but not die */
+                    ADDMSG(&b->region->msgs, msg_message("cryinpain", "unit", u));
+                }
+            }
+    return AT_AGE_KEEP;
 }
 
 static void
 write_hurting(const attrib * a, const void *owner, struct storage *store)
 {
-  building *b = a->data.v;
-  WRITE_INT(store, b->no);
+    building *b = a->data.v;
+    WRITE_INT(store, b->no);
 }
 
 static int read_hurting(attrib * a, void *owner, struct storage *store)
 {
-  int i;
-  READ_INT(store, &i);
-  a->data.v = (void *)findbuilding(i);
-  if (a->data.v == NULL) {
-    log_error("temple of pain is broken\n");
-    return AT_READ_FAIL;
-  }
-  return AT_READ_OK;
+    int i;
+    READ_INT(store, &i);
+    a->data.v = (void *)findbuilding(i);
+    if (a->data.v == NULL) {
+        log_error("temple of pain is broken\n");
+        return AT_READ_FAIL;
+    }
+    return AT_READ_OK;
 }
 
 static attrib_type at_hurting = {
-  "hurting", NULL, NULL, age_hurting, write_hurting, read_hurting
+    "hurting", NULL, NULL, age_hurting, write_hurting, read_hurting
 };
 
 #ifdef ARENA_CREATION
 static void make_temple(region * r)
 {
-  const building_type *btype = bt_find("temple");
-  building *b;
-  if (btype == NULL) {
-    log_error("could not find buildingtype 'temple'\n");
-    return;
-  }
+    const building_type *btype = bt_find("temple");
+    building *b;
+    if (btype == NULL) {
+        log_error("could not find buildingtype 'temple'\n");
+        return;
+    }
 
-  b = r->buildings;
-  while (b != NULL && b->type != btype)
-    b = b->next;
-  if (b != NULL)
-    return;                     /* gibt schon einen */
+    b = r->buildings;
+    while (b != NULL && b->type != btype)
+        b = b->next;
+    if (b != NULL)
+        return;                     /* gibt schon einen */
 
-  b = new_building(btype, r, NULL);
-  b->size = btype->maxsize;
-  b->name = _strdup("Igjarjuk's Tempel der Schreie");
-  b->display =
-    _strdup
-    ("Ein Schrein aus spitzen Knochen und lodernden Flammen, gewidmet dem Wyrm der Wyrme");
-  a_add(&b->attribs, a_new(&at_hurting))->data.v = b;
+    b = new_building(btype, r, NULL);
+    b->size = btype->maxsize;
+    b->name = _strdup("Igjarjuk's Tempel der Schreie");
+    b->display =
+        _strdup
+        ("Ein Schrein aus spitzen Knochen und lodernden Flammen, gewidmet dem Wyrm der Wyrme");
+    a_add(&b->attribs, a_new(&at_hurting))->data.v = b;
 }
 #endif
 
@@ -287,93 +287,93 @@ static void make_temple(region * r)
 #ifdef ARENA_CREATION
 static void tower_init(void)
 {
-  int i, first = newarena;
-  item_type *it_demonseye = it_find("demonseye");
-  item_type *it_griphonwing = it_find("griphonwing");
-  assert(it_griphonwing && it_demonseye);
-  for (i = 0; i != 6; ++i) {
-    region *r = tower_region[i] =
-      findregion(arena_center->x + delta_x[i] * 3,
-      arena_center->y + delta_y[i] * 3);
-    if (r) {
-      start_region[i] =
-        findregion(arena_center->x + delta_x[i] * 2,
-        arena_center->y + delta_y[i] * 2);
-      if (rterrain(r) != T_DESERT)
-        terraform(r, T_DESERT);
-      if (!r->buildings) {
-        building *b = new_building(bt_find("castle"), r, NULL);
-        b->size = 10;
-        if (i != 0) {
-          sprintf(buf, "Turm des %s",
-            LOC(default_locale, mkname("school", magic_school[i])));
-        } else
-          sprintf(buf, "Turm der Ahnungslosen");
-        set_string(&b->name, buf);
-      }
+    int i, first = newarena;
+    item_type *it_demonseye = it_find("demonseye");
+    item_type *it_griphonwing = it_find("griphonwing");
+    assert(it_griphonwing && it_demonseye);
+    for (i = 0; i != 6; ++i) {
+        region *r = tower_region[i] =
+            findregion(arena_center->x + delta_x[i] * 3,
+            arena_center->y + delta_y[i] * 3);
+        if (r) {
+            start_region[i] =
+                findregion(arena_center->x + delta_x[i] * 2,
+                arena_center->y + delta_y[i] * 2);
+            if (rterrain(r) != T_DESERT)
+                terraform(r, T_DESERT);
+            if (!r->buildings) {
+                building *b = new_building(bt_find("castle"), r, NULL);
+                b->size = 10;
+                if (i != 0) {
+                    sprintf(buf, "Turm des %s",
+                        LOC(default_locale, mkname("school", magic_school[i])));
+                } else
+                    sprintf(buf, "Turm der Ahnungslosen");
+                set_string(&b->name, buf);
+            }
+        }
     }
-  }
-  if (first && !arena_center->buildings) {
-    building *b = new_building(bt_find("castle"), arena_center, NULL);
-    attrib *a;
-    item *items;
+    if (first && !arena_center->buildings) {
+        building *b = new_building(bt_find("castle"), arena_center, NULL);
+        attrib *a;
+        item *items;
 
-    i_add(&items, i_new(it_griphonwing, 1));
-    i_add(&items, i_new(it_demonseye, 1));
-    a = a_add(&b->attribs, make_giveitem(b, items));
+        i_add(&items, i_new(it_griphonwing, 1));
+        i_add(&items, i_new(it_demonseye, 1));
+        a = a_add(&b->attribs, make_giveitem(b, items));
 
-    b->size = 10;
-    set_string(&b->name, "H�hle des Greifen");
-  }
+        b->size = 10;
+        set_string(&b->name, "H�hle des Greifen");
+    }
 }
 #endif
 
 #ifdef ARENA_CREATION
 static void guardian_faction(plane * pl, int id)
 {
-  region *r;
-  faction *f = findfaction(id);
+    region *r;
+    faction *f = findfaction(id);
 
-  if (!f) {
-    f = calloc(1, sizeof(faction));
-    f->banner = _strdup("Sie dienen dem gro�en Wyrm");
-    f->passw = _strdup(itoa36(rng_int()));
-    set_email(&f->email, "igjarjuk@eressea.de");
-    f->name = _strdup("Igjarjuks Kundschafter");
-    f->race = get_race(RC_ILLUSION);
-    f->age = turn;
-    f->locale = get_locale("de");
-    f->options =
-      want(O_COMPRESS) | want(O_REPORT) | want(O_COMPUTER) | want(O_ADRESSEN) |
-      want(O_DEBUG);
+    if (!f) {
+        f = calloc(1, sizeof(faction));
+        f->banner = _strdup("Sie dienen dem gro�en Wyrm");
+        f->passw = _strdup(itoa36(rng_int()));
+        set_email(&f->email, "igjarjuk@eressea.de");
+        f->name = _strdup("Igjarjuks Kundschafter");
+        f->race = get_race(RC_ILLUSION);
+        f->age = turn;
+        f->locale = get_locale("de");
+        f->options =
+            want(O_COMPRESS) | want(O_REPORT) | want(O_COMPUTER) | want(O_ADRESSEN) |
+            want(O_DEBUG);
 
-    f->no = id;
-    addlist(&factions, f);
-    fhash(f);
-  }
-  if (f->race != get_race(RC_ILLUSION)) {
-    assert(!"guardian id vergeben");
-    exit(0);
-  }
-  f->lastorders = turn;
-  f->alive = true;
-  for (r = regions; r; r = r->next)
-    if (getplane(r) == pl && rterrain(r) != T_FIREWALL) {
-      unit *u;
-      freset(r, RF_ENCOUNTER);
-      for (u = r->units; u; u = u->next) {
-        if (u->faction == f)
-          break;
-      }
-      if (u)
-        continue;
-      u = create_unit(r, f, 1, get_race(RC_GOBLIN), 0, NULL, NULL);
-      set_string(&u->name, "Igjarjuks Auge");
-      i_change(&u->items, it_find("roi"), 1);
-      set_order(&u->thisorder, NULL);
-      fset(u, UFL_ANON_FACTION);
-      set_money(u, 1000);
+        f->no = id;
+        addlist(&factions, f);
+        fhash(f);
     }
+    if (f->race != get_race(RC_ILLUSION)) {
+        assert(!"guardian id vergeben");
+        exit(0);
+    }
+    f->lastorders = turn;
+    f->alive = true;
+    for (r = regions; r; r = r->next)
+        if (getplane(r) == pl && rterrain(r) != T_FIREWALL) {
+            unit *u;
+            freset(r, RF_ENCOUNTER);
+            for (u = r->units; u; u = u->next) {
+                if (u->faction == f)
+                    break;
+            }
+            if (u)
+                continue;
+            u = create_unit(r, f, 1, get_race(RC_GOBLIN), 0, NULL, NULL);
+            set_string(&u->name, "Igjarjuks Auge");
+            i_change(&u->items, it_find("roi"), 1);
+            set_order(&u->thisorder, NULL);
+            fset(u, UFL_ANON_FACTION);
+            set_money(u, 1000);
+        }
 }
 #endif
 
@@ -382,13 +382,13 @@ static void guardian_faction(plane * pl, int id)
 #ifdef ARENA_CREATION
 static void block_create(int x1, int y1, char terrain)
 {
-  int x, y;
-  for (x = 0; x != BLOCKSIZE; ++x) {
-    for (y = 0; y != BLOCKSIZE; ++y) {
-      region *r = new_region(x1 + x, y1 + y, 0);
-      terraform(r, terrain);
+    int x, y;
+    for (x = 0; x != BLOCKSIZE; ++x) {
+        for (y = 0; y != BLOCKSIZE; ++y) {
+            region *r = new_region(x1 + x, y1 + y, 0);
+            terraform(r, terrain);
+        }
     }
-  }
 }
 #endif
 
@@ -396,93 +396,95 @@ static void block_create(int x1, int y1, char terrain)
 
 static int caldera_handle(trigger * t, void *data)
 {
-  /* call an event handler on caldera.
-   * data.v -> ( variant event, int timer )
-   */
-  building *b = (building *) t->data.v;
-  if (b != NULL) {
-    unit **up = &b->region->units;
-    while (*up) {
-      unit *u = *up;
-      if (u->building == b) {
-        message *msg;
-        if (u->items) {
-          item **ip = &u->items;
-          msg = msg_message("caldera_handle_1", "unit items", u, u->items);
-          while (*ip) {
-            item *i = *ip;
-            i_remove(ip, i);
-            if (*ip == i)
-              ip = &i->next;
-          }
-        } else {
-          msg = msg_message("caldera_handle_0", "unit", u);
+    /* call an event handler on caldera.
+     * data.v -> ( variant event, int timer )
+     */
+    building *b = (building *)t->data.v;
+    if (b != NULL) {
+        unit **up = &b->region->units;
+        while (*up) {
+            unit *u = *up;
+            if (u->building == b) {
+                message *msg;
+                if (u->items) {
+                    item **ip = &u->items;
+                    msg = msg_message("caldera_handle_1", "unit items", u, u->items);
+                    while (*ip) {
+                        item *i = *ip;
+                        i_remove(ip, i);
+                        if (*ip == i)
+                            ip = &i->next;
+                    }
+                }
+                else {
+                    msg = msg_message("caldera_handle_0", "unit", u);
+                }
+                add_message(&u->region->msgs, msg);
+                set_number(u, 0);
+            }
+            if (*up == u)
+                up = &u->next;
         }
-        add_message(&u->region->msgs, msg);
-        set_number(u, 0);
-      }
-      if (*up == u)
-        up = &u->next;
     }
-  } else {
-    log_error("could not perform caldera::handle()\n");
-  }
-  unused_arg(data);
-  return 0;
+    else {
+        log_error("could not perform caldera::handle()\n");
+    }
+    unused_arg(data);
+    return 0;
 }
 
 static void caldera_write(const trigger * t, struct storage *store)
 {
-  building *b = (building *) t->data.v;
-  write_building_reference(b, store);
+    building *b = (building *)t->data.v;
+    write_building_reference(b, store);
 }
 
 static int caldera_read(trigger * t, struct storage *store)
 {
-  int rb =
-    read_reference(&t->data.v, store, read_building_reference,
-    resolve_building);
-  if (rb == 0 && !t->data.v) {
-    return AT_READ_FAIL;
-  }
-  return AT_READ_OK;
+    int rb =
+        read_reference(&t->data.v, store, read_building_reference,
+        resolve_building);
+    if (rb == 0 && !t->data.v) {
+        return AT_READ_FAIL;
+    }
+    return AT_READ_OK;
 }
 
 struct trigger_type tt_caldera = {
-  "caldera",
-  NULL,
-  NULL,
-  caldera_handle,
-  caldera_write,
-  caldera_read
+    "caldera",
+    NULL,
+    NULL,
+    caldera_handle,
+    caldera_write,
+    caldera_read
 };
 
 #ifdef ARENA_CREATION
 static trigger *trigger_caldera(building * b)
 {
-  trigger *t = t_new(&tt_caldera);
-  t->data.v = b;
-  return t;
+    trigger *t = t_new(&tt_caldera);
+    t->data.v = b;
+    return t;
 }
 #endif
 
 #ifdef ARENA_CREATION
 static void init_volcano(void)
 {
-  building *b;
-  region *r = arena_center;
-  assert(arena_center);
-  if (rterrain(r) != T_DESERT)
-    return;                     /* been done before */
-  terraform(arena_center, T_VOLCANO_SMOKING);
-  b = new_building(bt_find("caldera"), r, NULL);
-  b->size = 1;
-  b->name = _strdup("Igjarjuk's Schlund");
-  b->display =
-    _strdup
-    ("Feurige Lava flie�t aus dem Krater des gro�en Vulkans. Alles wird von ihr verschlungen.");
-  add_trigger(&b->attribs, "timer", trigger_caldera(b));
-  tt_register(&tt_caldera);
+    building *b;
+    region *r = arena_center;
+    assert(arena_center);
+    if (rterrain(r) != T_DESERT)
+        return;                     /* been done before */
+    terraform(arena_center, T_VOLCANO_SMOKING);
+    b = new_building(bt_find("caldera"), r, NULL);
+    b->size = 1;
+    b->name = _strdup("Igjarjuk's Schlund");
+    b->display =
+        _strdup
+        ("Feurige Lava flie�t aus dem Krater des gro�en Vulkans. Alles wird von ihr verschlungen.");
+    add_trigger(&b->attribs, "timer", trigger_caldera(b));
+    tt_register(&tt_caldera);
 }
 #endif
 #endif
@@ -490,64 +492,64 @@ static void init_volcano(void)
 #ifdef ARENA_CREATION
 void create_arena(void)
 {
-  int x;
-  arena_id = hashstring("arena");
-  arena = getplanebyid(arena_id);
-  if (arena != NULL)
-    return;
-  score();                      /* ist wichtig, damit alle Parteien einen score haben, wenn sie durchs Tor wollen. */
-  guardian_faction(arena, 999);
-  if (arena)
-    arena_center = findregion(plane_center_x(arena), plane_center_y(arena));
-  if (!arena_center) {
-    newarena = 1;
-    arena =
-      create_new_plane(arena_id, "Arena", -10000, -10000, 0, BLOCKSIZE - 1,
-      PFL_LOWSTEALING | PFL_NORECRUITS | PFL_NOALLIANCES);
-    block_create(arena->minx, arena->miny, T_OCEAN);
-    arena_center = findregion(plane_center_x(arena), plane_center_y(arena));
-    for (x = 0; x != BLOCKSIZE; ++x) {
-      int y;
-      for (y = 0; y != BLOCKSIZE; ++y) {
-        region *r = findregion(arena->minx + x, arena->miny + y);
-        freset(r, RF_ENCOUNTER);
-        r->planep = arena;
-        switch (distance(r, arena_center)) {
-          case 4:
-            terraform(r, T_FIREWALL);
-            break;
-          case 0:
-            terraform(r, T_GLACIER);
-            break;
-          case 1:
-            terraform(r, T_SWAMP);
-            break;
-          case 2:
-            terraform(r, T_MOUNTAIN);
-            break;
+    int x;
+    arena_id = hashstring("arena");
+    arena = getplanebyid(arena_id);
+    if (arena != NULL)
+        return;
+    score();                      /* ist wichtig, damit alle Parteien einen score haben, wenn sie durchs Tor wollen. */
+    guardian_faction(arena, 999);
+    if (arena)
+        arena_center = findregion(plane_center_x(arena), plane_center_y(arena));
+    if (!arena_center) {
+        newarena = 1;
+        arena =
+            create_new_plane(arena_id, "Arena", -10000, -10000, 0, BLOCKSIZE - 1,
+            PFL_LOWSTEALING | PFL_NORECRUITS | PFL_NOALLIANCES);
+        block_create(arena->minx, arena->miny, T_OCEAN);
+        arena_center = findregion(plane_center_x(arena), plane_center_y(arena));
+        for (x = 0; x != BLOCKSIZE; ++x) {
+            int y;
+            for (y = 0; y != BLOCKSIZE; ++y) {
+                region *r = findregion(arena->minx + x, arena->miny + y);
+                freset(r, RF_ENCOUNTER);
+                r->planep = arena;
+                switch (distance(r, arena_center)) {
+                case 4:
+                    terraform(r, T_FIREWALL);
+                    break;
+                case 0:
+                    terraform(r, T_GLACIER);
+                    break;
+                case 1:
+                    terraform(r, T_SWAMP);
+                    break;
+                case 2:
+                    terraform(r, T_MOUNTAIN);
+                    break;
+                }
+            }
         }
-      }
     }
-  }
-  make_temple(arena_center);
+    make_temple(arena_center);
 #ifdef CENTRAL_VOLCANO
-  init_volcano();
+    init_volcano();
 #else
-  if (arena_center->terrain != T_DESERT)
-    terraform(arena_center, T_DESERT);
+    if (arena_center->terrain != T_DESERT)
+        terraform(arena_center, T_DESERT);
 #endif
-  rsetmoney(arena_center, 0);
-  rsetpeasants(arena_center, 0);
-  tower_init();
+    rsetmoney(arena_center, 0);
+    rsetpeasants(arena_center, 0);
+    tower_init();
 }
 #endif
 void register_arena(void)
 {
-  at_register(&at_hurting);
-  register_item_use(use_wand_of_tears, "use_wand_of_tears");
-  register_function((pf_generic) enter_arena, "enter_arena");
-  register_function((pf_generic) leave_arena, "leave_arena");
-  tt_register(&tt_caldera);
+    at_register(&at_hurting);
+    register_item_use(use_wand_of_tears, "use_wand_of_tears");
+    register_function((pf_generic)enter_arena, "enter_arena");
+    register_function((pf_generic)leave_arena, "leave_arena");
+    tt_register(&tt_caldera);
 }
 
 #endif /* def ARENA_MODULE */
diff --git a/src/modules/arena.h b/src/modules/arena.h
index 0b68d0471..ec07f49c8 100644
--- a/src/modules/arena.h
+++ b/src/modules/arena.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -25,12 +25,12 @@ extern "C" {
 #if ARENA_MODULE == 0
 #error "must define ARENA_MODULE to use this module"
 #endif
-/* exports: */
-  extern struct plane *arena;
+    /* exports: */
+    extern struct plane *arena;
 
-  extern void register_arena(void);
+    extern void register_arena(void);
 #ifdef ARENA_CREATION
-  extern void create_arena(void);
+    extern void create_arena(void);
 #endif
 
 #ifdef __cplusplus
diff --git a/src/modules/autoseed.c b/src/modules/autoseed.c
index 70daf5c1e..44b93943c 100644
--- a/src/modules/autoseed.c
+++ b/src/modules/autoseed.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/*
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
diff --git a/src/modules/autoseed.h b/src/modules/autoseed.h
index 923534020..9844d017c 100644
--- a/src/modules/autoseed.h
+++ b/src/modules/autoseed.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -6,9 +6,9 @@
  |                   |  Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
  +-------------------+  Stefan Reich <reich@halbling.de>
 
- This program may not be used, modified or distributed 
+ This program may not be used, modified or distributed
  without prior permission by the authors of Eressea.
-*/
+ */
 
 #ifndef _REGIONLIST_H
 #define _REGIONLIST_H
@@ -16,31 +16,31 @@
 extern "C" {
 #endif
 
-  struct newfaction;
+    struct newfaction;
 
-  typedef struct newfaction {
-    struct newfaction *next;
-    char *email;
-    char *password;
-    const struct locale *lang;
-    const struct race *race;
-    int bonus;
-    int subscription;
-    bool oldregions;
-    struct alliance *allies;
-  } newfaction;
+    typedef struct newfaction {
+        struct newfaction *next;
+        char *email;
+        char *password;
+        const struct locale *lang;
+        const struct race *race;
+        int bonus;
+        int subscription;
+        bool oldregions;
+        struct alliance *allies;
+    } newfaction;
 
 #define ISLANDSIZE 20
 #define TURNS_PER_ISLAND 5
 
-  extern int autoseed(newfaction ** players, int nsize, int max_agediff);
-  extern newfaction *read_newfactions(const char *filename);
-  extern int fix_demand(struct region *r);
-  extern const struct terrain_type *random_terrain(const struct terrain_type
-    *terrains[], int distribution[], int size);
+    extern int autoseed(newfaction ** players, int nsize, int max_agediff);
+    extern newfaction *read_newfactions(const char *filename);
+    extern int fix_demand(struct region *r);
+    extern const struct terrain_type *random_terrain(const struct terrain_type
+        *terrains[], int distribution[], int size);
 
-  extern int seed_adamantium(struct region *r, int base);
-  extern int build_island_e3(int x, int y, int numfactions, int minsize);
+    extern int seed_adamantium(struct region *r, int base);
+    extern int build_island_e3(int x, int y, int numfactions, int minsize);
 
 #ifdef __cplusplus
 }
diff --git a/src/modules/gmcmd.c b/src/modules/gmcmd.c
index d98ae9dbe..02bd2b889 100644
--- a/src/modules/gmcmd.c
+++ b/src/modules/gmcmd.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/*
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -8,7 +8,7 @@
 
  This program may not be used, modified or distributed
  without prior permission by the authors of Eressea.
-*/
+ */
 
 #include <platform.h>
 #include <kernel/config.h>
@@ -45,17 +45,17 @@
 
 static int read_permissions(attrib * a, void *owner, struct storage *store)
 {
-  assert(!a);
-  a_read(store, &a, owner);
-  a_remove(&a, a);
-  return AT_READ_OK;
+    assert(!a);
+    a_read(store, &a, owner);
+    a_remove(&a, a);
+    return AT_READ_OK;
 }
 
 static int read_gmcreate(attrib * a, void *owner, struct storage *store)
 {
-  char zText[32];
-  READ_TOK(store, zText, sizeof(zText));
-  return AT_READ_OK;
+    char zText[32];
+    READ_TOK(store, zText, sizeof(zText));
+    return AT_READ_OK;
 }
 
 void register_gmcmd(void)
diff --git a/src/modules/gmcmd.h b/src/modules/gmcmd.h
index 490792d2e..ec640fda4 100644
--- a/src/modules/gmcmd.h
+++ b/src/modules/gmcmd.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,27 +22,27 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  struct plane;
-  struct attrib;
-  struct unit;
-  struct faction;
-  struct region;
+    struct plane;
+    struct attrib;
+    struct unit;
+    struct faction;
+    struct region;
 
-  extern void register_gmcmd(void);
-/* initialize this module */
+    extern void register_gmcmd(void);
+    /* initialize this module */
 
-  extern void gmcommands(void);
-/* execute commands */
+    extern void gmcommands(void);
+    /* execute commands */
 
-  extern struct faction *gm_addfaction(const char *email, struct plane *p,
+    extern struct faction *gm_addfaction(const char *email, struct plane *p,
     struct region *r);
-  extern struct plane *gm_addplane(int radius, unsigned int flags,
-    const char *name);
+    extern struct plane *gm_addplane(int radius, unsigned int flags,
+        const char *name);
 
-/*
- * doesn't belong in here:
- */
-  struct attrib *find_key(struct attrib *attribs, int key);
+    /*
+     * doesn't belong in here:
+     */
+    struct attrib *find_key(struct attrib *attribs, int key);
 
 #ifdef __cplusplus
 }
diff --git a/src/modules/museum.c b/src/modules/museum.c
index ddd7c1c65..e2ab425a2 100644
--- a/src/modules/museum.c
+++ b/src/modules/museum.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
@@ -485,7 +485,7 @@ order * ord)
     assert(itype && ikey);
     assert(amount >= 1);
 
-    walk_connections(u->region, itype==ikey ? use_key1 : use_key2, u);
+    walk_connections(u->region, itype == ikey ? use_key1 : use_key2, u);
     return 0;
 }
 
diff --git a/src/modules/museum.h b/src/modules/museum.h
index 1073afcf0..10fa00b4b 100644
--- a/src/modules/museum.h
+++ b/src/modules/museum.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -26,25 +26,25 @@ extern "C" {
 #error "must define MUSEUM_MODULE to use this module"
 #endif
 
-  extern struct attrib_type at_warden;
-  extern struct attrib_type at_museumexit;
-  extern struct attrib_type at_museumgivebackcookie;
-  extern struct attrib_type at_museumgiveback;
+    extern struct attrib_type at_warden;
+    extern struct attrib_type at_museumexit;
+    extern struct attrib_type at_museumgivebackcookie;
+    extern struct attrib_type at_museumgiveback;
 
-  typedef struct {
-    int warden_no;
-    int cookie;
-  } museumgivebackcookie;
+    typedef struct {
+        int warden_no;
+        int cookie;
+    } museumgivebackcookie;
 
-  typedef struct {
-    int cookie;
-    struct item *items;
-  } museumgiveback;
+    typedef struct {
+        int cookie;
+        struct item *items;
+    } museumgiveback;
 
-  extern void register_museum(void);
-  extern void create_museum(void);
-  extern void warden_add_give(struct unit *src, struct unit *u,
-    const struct item_type *itype, int n);
+    extern void register_museum(void);
+    extern void create_museum(void);
+    extern void warden_add_give(struct unit *src, struct unit *u,
+        const struct item_type *itype, int n);
 
 #ifdef __cplusplus
 }
diff --git a/src/modules/score.c b/src/modules/score.c
index 2706d0847..4626d6211 100644
--- a/src/modules/score.c
+++ b/src/modules/score.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -42,176 +42,176 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 int average_score_of_age(int age, int a)
 {
-  faction *f;
-  int sum = 0, count = 0;
+    faction *f;
+    int sum = 0, count = 0;
 
-  for (f = factions; f; f = f->next) {
-      if (!fval(f, FFL_NPC) && f->age <= age + a
-          && f->age >= age - a && f->race != get_race(RC_TEMPLATE)) {
-      sum += f->score;
-      count++;
+    for (f = factions; f; f = f->next) {
+        if (!fval(f, FFL_NPC) && f->age <= age + a
+            && f->age >= age - a && f->race != get_race(RC_TEMPLATE)) {
+            sum += f->score;
+            count++;
+        }
     }
-  }
 
-  if (count == 0) {
-    return 0;
-  }
-  return sum / count;
+    if (count == 0) {
+        return 0;
+    }
+    return sum / count;
 }
 
 void score(void)
 {
-  FILE *scoreFP;
-  region *r;
-  faction *fc;
-  int allscores = 0;
-  char path[MAX_PATH];
+    FILE *scoreFP;
+    region *r;
+    faction *fc;
+    int allscores = 0;
+    char path[MAX_PATH];
 
-  for (fc = factions; fc; fc = fc->next)
-    fc->score = 0;
+    for (fc = factions; fc; fc = fc->next)
+        fc->score = 0;
 
-  for (r = regions; r; r = r->next) {
-    unit *u;
-    building *b;
-    ship *s;
+    for (r = regions; r; r = r->next) {
+        unit *u;
+        building *b;
+        ship *s;
 
-    if (rule_region_owners()) {
-      fc = region_get_owner(r);
-      if (fc)
-        fc->score += 10;
-    }
-
-    for (b = r->buildings; b; b = b->next) {
-      u = building_owner(b);
-      if (u != NULL) {
-        faction *fbo = u->faction;
-
-        if (fbo) {
-          fbo->score += b->size * 5;
+        if (rule_region_owners()) {
+            fc = region_get_owner(r);
+            if (fc)
+                fc->score += 10;
         }
-      }
-    }
 
-    for (s = r->ships; s; s = s->next) {
-      unit *cap = ship_owner(s);
-      if (cap && cap->faction) {
-        cap->faction->score += s->size * 2;
-      }
-    }
+        for (b = r->buildings; b; b = b->next) {
+            u = building_owner(b);
+            if (u != NULL) {
+                faction *fbo = u->faction;
 
-    for (u = r->units; u; u = u->next) {
-      item *itm;
-      int itemscore = 0;
-      int i;
-      faction *f = u->faction;
-
-      if (f == NULL || u_race(u) == get_race(RC_SPELL)
-          || u_race(u) == get_race(RC_BIRTHDAYDRAGON)) {
-        continue;
-      }
-
-      if (old_race(u_race(u)) <= RC_AQUARIAN) {
-        f->score += (u_race(u)->recruitcost * u->number) / 50;
-      }
-      f->score += get_money(u) / 50;
-      for (itm = u->items; itm; itm = itm->next) {
-        itemscore += itm->number * itm->type->score;
-      }
-      f->score += itemscore / 10;
-
-      for (i = 0; i != u->skill_size; ++i) {
-        skill *sv = u->skills + i;
-        switch (sv->id) {
-          case SK_MAGIC:
-            f->score += (int)(u->number * pow(sv->level, 4));
-            break;
-          case SK_TACTICS:
-            f->score += (int)(u->number * pow(sv->level, 3));
-            break;
-          case SK_SPY:
-          case SK_ALCHEMY:
-          case SK_HERBALISM:
-            f->score += (int)(u->number * pow(sv->level, 2.5));
-            break;
-          default:
-            f->score += (int)(u->number * pow(sv->level, 2.5) / 10);
-            break;
+                if (fbo) {
+                    fbo->score += b->size * 5;
+                }
+            }
+        }
+
+        for (s = r->ships; s; s = s->next) {
+            unit *cap = ship_owner(s);
+            if (cap && cap->faction) {
+                cap->faction->score += s->size * 2;
+            }
+        }
+
+        for (u = r->units; u; u = u->next) {
+            item *itm;
+            int itemscore = 0;
+            int i;
+            faction *f = u->faction;
+
+            if (f == NULL || u_race(u) == get_race(RC_SPELL)
+                || u_race(u) == get_race(RC_BIRTHDAYDRAGON)) {
+                continue;
+            }
+
+            if (old_race(u_race(u)) <= RC_AQUARIAN) {
+                f->score += (u_race(u)->recruitcost * u->number) / 50;
+            }
+            f->score += get_money(u) / 50;
+            for (itm = u->items; itm; itm = itm->next) {
+                itemscore += itm->number * itm->type->score;
+            }
+            f->score += itemscore / 10;
+
+            for (i = 0; i != u->skill_size; ++i) {
+                skill *sv = u->skills + i;
+                switch (sv->id) {
+                case SK_MAGIC:
+                    f->score += (int)(u->number * pow(sv->level, 4));
+                    break;
+                case SK_TACTICS:
+                    f->score += (int)(u->number * pow(sv->level, 3));
+                    break;
+                case SK_SPY:
+                case SK_ALCHEMY:
+                case SK_HERBALISM:
+                    f->score += (int)(u->number * pow(sv->level, 2.5));
+                    break;
+                default:
+                    f->score += (int)(u->number * pow(sv->level, 2.5) / 10);
+                    break;
+                }
+            }
         }
-      }
     }
-  }
 
-  for (fc = factions; fc; fc = fc->next) {
-    fc->score = fc->score / 5;
-    if (!fval(fc, FFL_NPC) && fc->race != get_race(RC_TEMPLATE)) {
-      allscores += fc->score;
+    for (fc = factions; fc; fc = fc->next) {
+        fc->score = fc->score / 5;
+        if (!fval(fc, FFL_NPC) && fc->race != get_race(RC_TEMPLATE)) {
+            allscores += fc->score;
+        }
+    }
+    if (allscores == 0) {
+        allscores = 1;
     }
-  }
-  if (allscores == 0) {
-    allscores = 1;
-  }
 
-  sprintf(path, "%s/score", basepath());
-  scoreFP = fopen(path, "w");
-  if (scoreFP) {
-    const unsigned char utf8_bom[4] = { 0xef, 0xbb, 0xbf, 0 };
-    faction *f;
-    fwrite(utf8_bom, 1, 3, scoreFP);
-    for (f = factions; f; f = f->next)
-      if (f->num_total != 0) {
-        fprintf(scoreFP, "%8d (%8d/%4.2f%%/%5.2f) %30.30s (%3.3s) %5s (%3d)\n",
-          f->score, f->score - average_score_of_age(f->age, f->age / 24 + 1),
-          ((float)f->score / (float)allscores) * 100.0,
-          (float)f->score / f->num_total,
-          f->name, LOC(default_locale, rc_name_s(f->race, NAME_SINGULAR)), factionid(f),
-          f->age);
-      }
-    fclose(scoreFP);
-  }
-  if (alliances != NULL) {
-    alliance *a;
-    const item_type *token = it_find("conquesttoken");
-
-    sprintf(path, "%s/score.alliances", basepath());
+    sprintf(path, "%s/score", basepath());
     scoreFP = fopen(path, "w");
     if (scoreFP) {
-      const unsigned char utf8_bom[4] = { 0xef, 0xbb, 0xbf, 0 };
-      fwrite(utf8_bom, 1, 3, scoreFP);
-
-      fprintf(scoreFP, "# alliance:factions:persons:score\n");
-
-      for (a = alliances; a; a = a->next) {
-        int alliance_score = 0, alliance_number = 0, alliance_factions = 0;
-        int grails = 0;
+        const unsigned char utf8_bom[4] = { 0xef, 0xbb, 0xbf, 0 };
         faction *f;
-
-        for (f = factions; f; f = f->next) {
-          if (f->alliance && f->alliance == a) {
-            alliance_factions++;
-            alliance_score += f->score;
-            alliance_number += f->num_total;
-            if (token != NULL) {
-              unit *u = f->units;
-              while (u != NULL) {
-                item **iitem = i_find(&u->items, token);
-                if (iitem != NULL && *iitem != NULL) {
-                  grails += (*iitem)->number;
-                }
-                u = u->nextF;
-              }
+        fwrite(utf8_bom, 1, 3, scoreFP);
+        for (f = factions; f; f = f->next)
+            if (f->num_total != 0) {
+                fprintf(scoreFP, "%8d (%8d/%4.2f%%/%5.2f) %30.30s (%3.3s) %5s (%3d)\n",
+                    f->score, f->score - average_score_of_age(f->age, f->age / 24 + 1),
+                    ((float)f->score / (float)allscores) * 100.0,
+                    (float)f->score / f->num_total,
+                    f->name, LOC(default_locale, rc_name_s(f->race, NAME_SINGULAR)), factionid(f),
+                    f->age);
             }
-          }
-        }
-
-        fprintf(scoreFP, "%d:%d:%d:%d", a->id, alliance_factions,
-          alliance_number, alliance_score);
-        if (token != NULL)
-          fprintf(scoreFP, ":%d", grails);
-        fputc('\n', scoreFP);
-      }
-      fclose(scoreFP);
+        fclose(scoreFP);
+    }
+    if (alliances != NULL) {
+        alliance *a;
+        const item_type *token = it_find("conquesttoken");
+
+        sprintf(path, "%s/score.alliances", basepath());
+        scoreFP = fopen(path, "w");
+        if (scoreFP) {
+            const unsigned char utf8_bom[4] = { 0xef, 0xbb, 0xbf, 0 };
+            fwrite(utf8_bom, 1, 3, scoreFP);
+
+            fprintf(scoreFP, "# alliance:factions:persons:score\n");
+
+            for (a = alliances; a; a = a->next) {
+                int alliance_score = 0, alliance_number = 0, alliance_factions = 0;
+                int grails = 0;
+                faction *f;
+
+                for (f = factions; f; f = f->next) {
+                    if (f->alliance && f->alliance == a) {
+                        alliance_factions++;
+                        alliance_score += f->score;
+                        alliance_number += f->num_total;
+                        if (token != NULL) {
+                            unit *u = f->units;
+                            while (u != NULL) {
+                                item **iitem = i_find(&u->items, token);
+                                if (iitem != NULL && *iitem != NULL) {
+                                    grails += (*iitem)->number;
+                                }
+                                u = u->nextF;
+                            }
+                        }
+                    }
+                }
+
+                fprintf(scoreFP, "%d:%d:%d:%d", a->id, alliance_factions,
+                    alliance_number, alliance_score);
+                if (token != NULL)
+                    fprintf(scoreFP, ":%d", grails);
+                fputc('\n', scoreFP);
+            }
+            fclose(scoreFP);
+        }
     }
-  }
 }
 
 #endif
diff --git a/src/modules/score.h b/src/modules/score.h
index 1140e0568..bded23f4e 100644
--- a/src/modules/score.h
+++ b/src/modules/score.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -26,8 +26,8 @@ extern "C" {
 #error "must define SCORE_MODULE to use this module"
 #endif
 
-  extern void score(void);
-  extern int average_score_of_age(int age, int a);
+    extern void score(void);
+    extern int average_score_of_age(int age, int a);
 
 #ifdef __cplusplus
 }
diff --git a/src/modules/weather.c b/src/modules/weather.c
index 793e7da73..ca1c3b802 100644
--- a/src/modules/weather.c
+++ b/src/modules/weather.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -27,97 +27,97 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 weather *create_weather(region * r, weather_t type)
 {
-  weather *w;
+    weather *w;
 
-  w = calloc(1, sizeof(weather));
-  w->center[0] = r->x;
-  w->center[1] = r->y;
-  w->type = type;
-  w->move[0] = (rng_int() % 3) - 1;
-  w->move[1] = (rng_int() % 3) - 1;
+    w = calloc(1, sizeof(weather));
+    w->center[0] = r->x;
+    w->center[1] = r->y;
+    w->type = type;
+    w->move[0] = (rng_int() % 3) - 1;
+    w->move[1] = (rng_int() % 3) - 1;
 
-  switch (type) {
+    switch (type) {
     case WEATHER_STORM:
-      w->radius = rng_int() % 2 + 1;
-      break;
+        w->radius = rng_int() % 2 + 1;
+        break;
     case WEATHER_HURRICANE:
-      w->radius = 1;
-      break;
+        w->radius = 1;
+        break;
     default:
-      w->radius = 0;
-  }
+        w->radius = 0;
+    }
 
-  addlist(&weathers, w);
+    addlist(&weathers, w);
 
-  return w;
+    return w;
 }
 
 double distance(int x1, int y1, int x2, int y2)
 {
-  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
+    return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
 }
 
 /* Diese Funktion ermittelt f�r jede Region, welches Wetter in ihr
    herrscht. Die Wettertypen sind dabei nach ihrer Reihenfolge in der
-	 enumeration priorisiert.
+   enumeration priorisiert.
 
-	 - Einladen
-	 set_weather();
-	 - Eigentliche Auswertung
-	 - Ver�nderungen des Wetters
-	 set_weather();
-	 - Report generieren
-	 - Abspeichern
+   - Einladen
+   set_weather();
+   - Eigentliche Auswertung
+   - Ver�nderungen des Wetters
+   set_weather();
+   - Report generieren
+   - Abspeichern
 
-	 Diese Routine ist sehr rechenaufwendig!
-*/
+   Diese Routine ist sehr rechenaufwendig!
+   */
 
 void set_weather(void)
 {
-  weather_t i;
-  weather *w;
-  short x, y;
-  int d;
-  region *r;
+    weather_t i;
+    weather *w;
+    short x, y;
+    int d;
+    region *r;
 
-  for (r = regions; r; r = r->next) {
-    r->weathertype = WEATHER_NONE;
-  }
-
-  for (i = 0; i < MAXWEATHERS; i++) {
-    for (w = weathers; w; w = w->next) {
-      if (w->type == i) {
-        for (x = w->center[0] - w->radius; x <= w->center[0] + w->radius; x++) {
-          for (y = w->center[1] - w->radius; y <= w->center[1] + w->radius; y++) {
-            d = distance(w->center[0], w->center[1], x, y);
-            if (floor(d + 0.5) <= w->radius) {
-              r = findregion(x, y);
-              if (r) {
-                r->weathertype = w->type;
-              }
-            }
-          }
-        }
-      }
+    for (r = regions; r; r = r->next) {
+        r->weathertype = WEATHER_NONE;
+    }
+
+    for (i = 0; i < MAXWEATHERS; i++) {
+        for (w = weathers; w; w = w->next) {
+            if (w->type == i) {
+                for (x = w->center[0] - w->radius; x <= w->center[0] + w->radius; x++) {
+                    for (y = w->center[1] - w->radius; y <= w->center[1] + w->radius; y++) {
+                        d = distance(w->center[0], w->center[1], x, y);
+                        if (floor(d + 0.5) <= w->radius) {
+                            r = findregion(x, y);
+                            if (r) {
+                                r->weathertype = w->type;
+                            }
+                        }
+                    }
+                }
+            }
+        }
     }
-  }
 }
 
 void move_weather(void)
 {
-  weather *w, *wnext;
-  region *r;
+    weather *w, *wnext;
+    region *r;
 
-  for (w = weathers; w;) {
-    wnext = w->next;
-    w->center[0] = w->center[0] + w->move[0];
-    w->center[1] = w->center[1] + w->move[1];
-    r = findregion(w->center[0], w->center[1]);
-    if (!r || rng_int() % 100 < 5) {
-      removelist(&weathers, w);
+    for (w = weathers; w;) {
+        wnext = w->next;
+        w->center[0] = w->center[0] + w->move[0];
+        w->center[1] = w->center[1] + w->move[1];
+        r = findregion(w->center[0], w->center[1]);
+        if (!r || rng_int() % 100 < 5) {
+            removelist(&weathers, w);
+        }
+        w = wnext;
     }
-    w = wnext;
-  }
 }
 
 #else
@@ -126,7 +126,7 @@ static const char *copyright = "(c) Eressea PBEM 2000";
 
 void init_weather(void)
 {
-  fputs(copyright, stderr);
-  /* TODO: Initialization */
+    fputs(copyright, stderr);
+    /* TODO: Initialization */
 }
 #endif
diff --git a/src/modules/weather.h b/src/modules/weather.h
index b991dbaf9..50521c0c7 100644
--- a/src/modules/weather.h
+++ b/src/modules/weather.h
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
                          Katja Zedel <katze@felidae.kn-bremen.de
                          Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/modules/xmas.c b/src/modules/xmas.c
index d32846f5d..1aa8aaba7 100644
--- a/src/modules/xmas.c
+++ b/src/modules/xmas.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -6,9 +6,9 @@
  |                   |  Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
  +-------------------+  Stefan Reich <reich@halbling.de>
 
- This program may not be used, modified or distributed 
+ This program may not be used, modified or distributed
  without prior permission by the authors of Eressea.
-*/
+ */
 
 #include <platform.h>
 #include <kernel/config.h>
@@ -38,43 +38,43 @@
 
 static int xmasgate_handle(trigger * t, void *data)
 {
-  return -1;
+    return -1;
 }
 
 static void xmasgate_write(const trigger * t, struct storage *store)
 {
-  building *b = (building *) t->data.v;
-  WRITE_TOK(store, itoa36(b->no));
+    building *b = (building *)t->data.v;
+    WRITE_TOK(store, itoa36(b->no));
 }
 
 static int xmasgate_read(trigger * t, struct storage *store)
 {
-  int bc =
-    read_reference(&t->data.v, store, read_building_reference,
-    resolve_building);
-  if (bc == 0 && !t->data.v) {
-    return AT_READ_FAIL;
-  }
-  return AT_READ_OK;
+    int bc =
+        read_reference(&t->data.v, store, read_building_reference,
+        resolve_building);
+    if (bc == 0 && !t->data.v) {
+        return AT_READ_FAIL;
+    }
+    return AT_READ_OK;
 }
 
 struct trigger_type tt_xmasgate = {
-  "xmasgate",
-  NULL,
-  NULL,
-  xmasgate_handle,
-  xmasgate_write,
-  xmasgate_read
+    "xmasgate",
+    NULL,
+    NULL,
+    xmasgate_handle,
+    xmasgate_write,
+    xmasgate_read
 };
 
 trigger *trigger_xmasgate(building * b)
 {
-  trigger *t = t_new(&tt_xmasgate);
-  t->data.v = b;
-  return t;
+    trigger *t = t_new(&tt_xmasgate);
+    t->data.v = b;
+    return t;
 }
 
 void register_xmas(void)
 {
-  tt_register(&tt_xmasgate);
+    tt_register(&tt_xmasgate);
 }
diff --git a/src/modules/xmas.h b/src/modules/xmas.h
index 8cd6086fe..f1f417622 100644
--- a/src/modules/xmas.h
+++ b/src/modules/xmas.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
diff --git a/src/monster.c b/src/monster.c
index 3683b7f09..97104b655 100644
--- a/src/monster.c
+++ b/src/monster.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -69,9 +69,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 bool monster_is_waiting(const unit * u)
 {
-  if (fval(u, UFL_ISNEW | UFL_MOVED))
-    return true;
-  return false;
+    if (fval(u, UFL_ISNEW | UFL_MOVED))
+        return true;
+    return false;
 }
 
 static void eaten_by_monster(unit * u)
@@ -105,7 +105,7 @@ static void eaten_by_monster(unit * u)
     if (n > 0) {
         n = lovar(n);
         n = _min(rpeasants(u->region), n);
-        
+
         if (n > 0) {
             deathcounts(u->region, n);
             rsetpeasants(u->region, rpeasants(u->region) - n);
@@ -120,101 +120,101 @@ static void eaten_by_monster(unit * u)
 
 static void absorbed_by_monster(unit * u)
 {
-  int n;
+    int n;
 
-  switch (old_race(u_race(u))) {
+    switch (old_race(u_race(u))) {
     default:
-      n = rng_int() % (u->number / 20 + 1);
-  }
-
-  if (n > 0) {
-    n = lovar(n);
-    n = _min(rpeasants(u->region), n);
-    if (n > 0) {
-      rsetpeasants(u->region, rpeasants(u->region) - n);
-      scale_number(u, u->number + n);
-      ADDMSG(&u->region->msgs, msg_message("absorbpeasants",
-          "unit race amount", u, u_race(u), n));
+        n = rng_int() % (u->number / 20 + 1);
+    }
+
+    if (n > 0) {
+        n = lovar(n);
+        n = _min(rpeasants(u->region), n);
+        if (n > 0) {
+            rsetpeasants(u->region, rpeasants(u->region) - n);
+            scale_number(u, u->number + n);
+            ADDMSG(&u->region->msgs, msg_message("absorbpeasants",
+                "unit race amount", u, u_race(u), n));
+        }
     }
-  }
 }
 
 static int scareaway(region * r, int anzahl)
 {
-  int n, p, diff = 0, emigrants[MAXDIRECTIONS];
-  direction_t d;
+    int n, p, diff = 0, emigrants[MAXDIRECTIONS];
+    direction_t d;
 
-  anzahl = _min(_max(1, anzahl), rpeasants(r));
+    anzahl = _min(_max(1, anzahl), rpeasants(r));
 
-  /* Wandern am Ende der Woche (normal) oder wegen Monster. Die
-   * Wanderung wird erst am Ende von demographics () ausgefuehrt.
-   * emigrants[] ist local, weil r->newpeasants durch die Monster
-   * vielleicht schon hochgezaehlt worden ist. */
+    /* Wandern am Ende der Woche (normal) oder wegen Monster. Die
+     * Wanderung wird erst am Ende von demographics () ausgefuehrt.
+     * emigrants[] ist local, weil r->newpeasants durch die Monster
+     * vielleicht schon hochgezaehlt worden ist. */
 
-  for (d = 0; d != MAXDIRECTIONS; d++)
-    emigrants[d] = 0;
+    for (d = 0; d != MAXDIRECTIONS; d++)
+        emigrants[d] = 0;
 
-  p = rpeasants(r);
-  assert(p >= 0 && anzahl >= 0);
-  for (n = _min(p, anzahl); n; n--) {
-    direction_t dir = (direction_t) (rng_int() % MAXDIRECTIONS);
-    region *rc = rconnect(r, dir);
+    p = rpeasants(r);
+    assert(p >= 0 && anzahl >= 0);
+    for (n = _min(p, anzahl); n; n--) {
+        direction_t dir = (direction_t)(rng_int() % MAXDIRECTIONS);
+        region *rc = rconnect(r, dir);
 
-    if (rc && fval(rc->terrain, LAND_REGION)) {
-      ++diff;
-      rc->land->newpeasants++;
-      emigrants[dir]++;
+        if (rc && fval(rc->terrain, LAND_REGION)) {
+            ++diff;
+            rc->land->newpeasants++;
+            emigrants[dir]++;
+        }
     }
-  }
-  rsetpeasants(r, p - diff);
-  assert(p >= diff);
-  return diff;
+    rsetpeasants(r, p - diff);
+    assert(p >= diff);
+    return diff;
 }
 
 static void scared_by_monster(unit * u)
 {
-  int n;
+    int n;
 
-  switch (old_race(u_race(u))) {
+    switch (old_race(u_race(u))) {
     case RC_FIREDRAGON:
-      n = rng_int() % 160 * u->number;
-      break;
+        n = rng_int() % 160 * u->number;
+        break;
     case RC_DRAGON:
-      n = rng_int() % 400 * u->number;
-      break;
+        n = rng_int() % 400 * u->number;
+        break;
     case RC_WYRM:
-      n = rng_int() % 1000 * u->number;
-      break;
+        n = rng_int() % 1000 * u->number;
+        break;
     default:
-      n = rng_int() % (u->number / 4 + 1);
-  }
-
-  if (n > 0) {
-    n = lovar(n);
-    n = _min(rpeasants(u->region), n);
-    if (n > 0) {
-      n = scareaway(u->region, n);
-      if (n > 0) {
-        ADDMSG(&u->region->msgs, msg_message("fleescared",
-            "amount unit", n, u));
-      }
+        n = rng_int() % (u->number / 4 + 1);
+    }
+
+    if (n > 0) {
+        n = lovar(n);
+        n = _min(rpeasants(u->region), n);
+        if (n > 0) {
+            n = scareaway(u->region, n);
+            if (n > 0) {
+                ADDMSG(&u->region->msgs, msg_message("fleescared",
+                    "amount unit", n, u));
+            }
+        }
     }
-  }
 }
 
 void monster_kills_peasants(unit * u)
 {
-  if (!monster_is_waiting(u)) {
-    if (u_race(u)->flags & RCF_SCAREPEASANTS) {
-      scared_by_monster(u);
+    if (!monster_is_waiting(u)) {
+        if (u_race(u)->flags & RCF_SCAREPEASANTS) {
+            scared_by_monster(u);
+        }
+        if (u_race(u)->flags & RCF_KILLPEASANTS) {
+            eaten_by_monster(u);
+        }
+        if (u_race(u)->flags & RCF_ABSORBPEASANTS) {
+            absorbed_by_monster(u);
+        }
     }
-    if (u_race(u)->flags & RCF_KILLPEASANTS) {
-      eaten_by_monster(u);
-    }
-    if (u_race(u)->flags & RCF_ABSORBPEASANTS) {
-      absorbed_by_monster(u);
-    }
-  }
 }
 
 faction *get_or_create_monsters(void)
diff --git a/src/monster.h b/src/monster.h
index 30095d924..6d7709f55 100644
--- a/src/monster.h
+++ b/src/monster.h
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/monsters.c b/src/monsters.c
index 8c3f5bcf6..85e043eed 100644
--- a/src/monsters.c
+++ b/src/monsters.c
@@ -1,7 +1,5 @@
-/* vi: set ts=2:
- *
- *
- *	Eressea PB(E)M host Copyright (C) 1998-2003
+/*
+ *	Eressea PB(E)M host Copyright (C) 1998-2015
  *      Christian Schlittchen (corwin@amber.kn-bremen.de)
  *      Katja Zedel (katze@felidae.kn-bremen.de)
  *      Henning Peters (faroul@beyond.kn-bremen.de)
@@ -78,60 +76,60 @@
 
 static void reduce_weight(unit * u)
 {
-  int capacity, weight = 0;
-  item **itmp = &u->items;
-  int horses = get_resource(u, get_resourcetype(R_HORSE));
+    int capacity, weight = 0;
+    item **itmp = &u->items;
+    int horses = get_resource(u, get_resourcetype(R_HORSE));
 
-  if (horses > 0) {
-    horses = _min(horses, (u->number * 2));
-    change_resource(u, get_resourcetype(R_HORSE), -horses);
-  }
-
-  /* 0. ditch any vehicles */
-  while (*itmp != NULL) {
-    item *itm = *itmp;
-    const item_type *itype = itm->type;
-    weight += itm->number * itype->weight;
-    if (itype->flags & ITF_VEHICLE) {
-      give_item(itm->number, itm->type, u, NULL, NULL);
+    if (horses > 0) {
+        horses = _min(horses, (u->number * 2));
+        change_resource(u, get_resourcetype(R_HORSE), -horses);
     }
-    if (*itmp == itm)
-      itmp = &itm->next;
-  }
 
-  capacity = walkingcapacity(u);
-
-  /* 1. get rid of anything that isn't silver or really lightweight or helpful in combat */
-  for (itmp = &u->items; *itmp && capacity > 0;) {
-    item *itm = *itmp;
-    const item_type *itype = itm->type;
-    weight += itm->number * itype->weight;
-    if (weight > capacity) {
-      if (itype->weight >= 10 && itype->rtype->wtype == 0
-        && itype->rtype->atype == 0) {
-        if (itype->capacity < itype->weight) {
-          int reduce = _min(itm->number, -((capacity - weight) / itype->weight));
-          give_item(reduce, itm->type, u, NULL, NULL);
-          weight -= reduce * itype->weight;
+    /* 0. ditch any vehicles */
+    while (*itmp != NULL) {
+        item *itm = *itmp;
+        const item_type *itype = itm->type;
+        weight += itm->number * itype->weight;
+        if (itype->flags & ITF_VEHICLE) {
+            give_item(itm->number, itm->type, u, NULL, NULL);
         }
-      }
+        if (*itmp == itm)
+            itmp = &itm->next;
     }
-    if (*itmp == itm)
-      itmp = &itm->next;
-  }
 
-  for (itmp = &u->items; *itmp && weight > capacity;) {
-    item *itm = *itmp;
-    const item_type *itype = itm->type;
-    weight += itm->number * itype->weight;
-    if (itype->capacity < itype->weight) {
-      int reduce = _min(itm->number, -((capacity - weight) / itype->weight));
-      give_item(reduce, itm->type, u, NULL, NULL);
-      weight -= reduce * itype->weight;
+    capacity = walkingcapacity(u);
+
+    /* 1. get rid of anything that isn't silver or really lightweight or helpful in combat */
+    for (itmp = &u->items; *itmp && capacity > 0;) {
+        item *itm = *itmp;
+        const item_type *itype = itm->type;
+        weight += itm->number * itype->weight;
+        if (weight > capacity) {
+            if (itype->weight >= 10 && itype->rtype->wtype == 0
+                && itype->rtype->atype == 0) {
+                if (itype->capacity < itype->weight) {
+                    int reduce = _min(itm->number, -((capacity - weight) / itype->weight));
+                    give_item(reduce, itm->type, u, NULL, NULL);
+                    weight -= reduce * itype->weight;
+                }
+            }
+        }
+        if (*itmp == itm)
+            itmp = &itm->next;
+    }
+
+    for (itmp = &u->items; *itmp && weight > capacity;) {
+        item *itm = *itmp;
+        const item_type *itype = itm->type;
+        weight += itm->number * itype->weight;
+        if (itype->capacity < itype->weight) {
+            int reduce = _min(itm->number, -((capacity - weight) / itype->weight));
+            give_item(reduce, itm->type, u, NULL, NULL);
+            weight -= reduce * itype->weight;
+        }
+        if (*itmp == itm)
+            itmp = &itm->next;
     }
-    if (*itmp == itm)
-      itmp = &itm->next;
-  }
 }
 
 static float monster_attack_chance(void) {
@@ -140,16 +138,16 @@ static float monster_attack_chance(void) {
 
 static order *monster_attack(unit * u, const unit * target)
 {
-  if (u->region != target->region)
-    return NULL;
-  if (u->faction == target->faction)
-    return NULL;
-  if (!cansee(u->faction, u->region, target, 0))
-    return NULL;
-  if (monster_is_waiting(u))
-    return NULL;
+    if (u->region != target->region)
+        return NULL;
+    if (u->faction == target->faction)
+        return NULL;
+    if (!cansee(u->faction, u->region, target, 0))
+        return NULL;
+    if (monster_is_waiting(u))
+        return NULL;
 
-  return create_order(K_ATTACK, u->faction->locale, "%i", target->no);
+    return create_order(K_ATTACK, u->faction->locale, "%i", target->no);
 }
 
 static order *get_money_for_dragon(region * r, unit * u, int wanted)
@@ -157,7 +155,7 @@ static order *get_money_for_dragon(region * r, unit * u, int wanted)
     unit *u2;
     int n;
     double attack_chance = monster_attack_chance();
-   
+
     if (attack_chance > 0.0 && is_guard(u, GUARD_TAX)) {
         /* attackiere bewachende Einheiten nur wenn wir selbst schon bewachen */
         for (u2 = r->units; u2; u2 = u2->next) {
@@ -209,674 +207,685 @@ static order *get_money_for_dragon(region * r, unit * u, int wanted)
 
 static int all_money(region * r, faction * f)
 {
-  unit *u;
-  int m;
+    unit *u;
+    int m;
 
-  m = rmoney(r);
-  for (u = r->units; u; u = u->next) {
-    if (f != u->faction) {
-      m += get_money(u);
+    m = rmoney(r);
+    for (u = r->units; u; u = u->next) {
+        if (f != u->faction) {
+            m += get_money(u);
+        }
     }
-  }
-  return m;
+    return m;
 }
 
 static direction_t richest_neighbour(region * r, faction * f, int absolut)
 {
 
-  /* m - maximum an Geld, d - Richtung, i - index, t = Geld hier */
+    /* m - maximum an Geld, d - Richtung, i - index, t = Geld hier */
 
-  double m;
-  double t;
-  direction_t d = NODIRECTION, i;
+    double m;
+    double t;
+    direction_t d = NODIRECTION, i;
 
-  if (absolut == 1 || rpeasants(r) == 0) {
-    m = (double)all_money(r, f);
-  } else {
-    m = (double)all_money(r, f) / (double)rpeasants(r);
-  }
-
-  /* finde die region mit dem meisten geld */
-
-  for (i = 0; i != MAXDIRECTIONS; i++) {
-    region *rn = rconnect(r, i);
-    if (rn != NULL && fval(rn->terrain, LAND_REGION)) {
-      if (absolut == 1 || rpeasants(rn) == 0) {
-        t = (double)all_money(rn, f);
-      } else {
-        t = (double)all_money(rn, f) / (double)rpeasants(rn);
-      }
-
-      if (t > m) {
-        m = t;
-        d = i;
-      }
+    if (absolut == 1 || rpeasants(r) == 0) {
+        m = (double)all_money(r, f);
     }
-  }
-  return d;
+    else {
+        m = (double)all_money(r, f) / (double)rpeasants(r);
+    }
+
+    /* finde die region mit dem meisten geld */
+
+    for (i = 0; i != MAXDIRECTIONS; i++) {
+        region *rn = rconnect(r, i);
+        if (rn != NULL && fval(rn->terrain, LAND_REGION)) {
+            if (absolut == 1 || rpeasants(rn) == 0) {
+                t = (double)all_money(rn, f);
+            }
+            else {
+                t = (double)all_money(rn, f) / (double)rpeasants(rn);
+            }
+
+            if (t > m) {
+                m = t;
+                d = i;
+            }
+        }
+    }
+    return d;
 }
 
 static bool room_for_race_in_region(region * r, const race * rc)
 {
-  unit *u;
-  int c = 0;
+    unit *u;
+    int c = 0;
 
-  for (u = r->units; u; u = u->next) {
-    if (u_race(u) == rc)
-      c += u->number;
-  }
+    for (u = r->units; u; u = u->next) {
+        if (u_race(u) == rc)
+            c += u->number;
+    }
 
-  if (c > (rc->splitsize * 2))
-    return false;
+    if (c > (rc->splitsize * 2))
+        return false;
 
-  return true;
+    return true;
 }
 
 static direction_t random_neighbour(region * r, unit * u)
 {
-  int i;
-  region *rc;
-  region * next[MAXDIRECTIONS];
-  int rr, c = 0, c2 = 0;
+    int i;
+    region *rc;
+    region * next[MAXDIRECTIONS];
+    int rr, c = 0, c2 = 0;
 
-  get_neighbours(r, next);
-  /* Nachsehen, wieviele Regionen in Frage kommen */
+    get_neighbours(r, next);
+    /* Nachsehen, wieviele Regionen in Frage kommen */
 
-  for (i = 0; i != MAXDIRECTIONS; i++) {
-    rc = next[i];
-    if (rc && can_survive(u, rc)) {
-      if (room_for_race_in_region(rc, u_race(u))) {
-        c++;
-      }
-      c2++;
+    for (i = 0; i != MAXDIRECTIONS; i++) {
+        rc = next[i];
+        if (rc && can_survive(u, rc)) {
+            if (room_for_race_in_region(rc, u_race(u))) {
+                c++;
+            }
+            c2++;
+        }
     }
-  }
 
-  if (c == 0) {
-    if (c2 == 0) {
-      return NODIRECTION;
-    } else {
-      c = c2;
-      c2 = 0;                   /* c2 == 0 -> room_for_race nicht beachten */
+    if (c == 0) {
+        if (c2 == 0) {
+            return NODIRECTION;
+        }
+        else {
+            c = c2;
+            c2 = 0;                   /* c2 == 0 -> room_for_race nicht beachten */
+        }
     }
-  }
 
-  /* Zuf�llig eine ausw�hlen */
+    /* Zuf�llig eine ausw�hlen */
 
-  rr = rng_int() % c;
+    rr = rng_int() % c;
 
-  /* Durchz�hlen */
+    /* Durchz�hlen */
 
-  c = -1;
-  for (i = 0; i != MAXDIRECTIONS; i++) {
-    rc = next[i];
-    if (rc && can_survive(u, rc)) {
-      if (c2 == 0) {
-        c++;
-      } else if (room_for_race_in_region(rc, u_race(u))) {
-        c++;
-      }
-      if (c == rr)
-        return (direction_t)i;
+    c = -1;
+    for (i = 0; i != MAXDIRECTIONS; i++) {
+        rc = next[i];
+        if (rc && can_survive(u, rc)) {
+            if (c2 == 0) {
+                c++;
+            }
+            else if (room_for_race_in_region(rc, u_race(u))) {
+                c++;
+            }
+            if (c == rr)
+                return (direction_t)i;
+        }
     }
-  }
 
-  assert(1 == 0);               /* Bis hierhin sollte er niemals kommen. */
-  return NODIRECTION;
+    assert(1 == 0);               /* Bis hierhin sollte er niemals kommen. */
+    return NODIRECTION;
 }
 
 static direction_t treeman_neighbour(region * r)
 {
-  int i;
-  int rr;
-  int c = 0;
-  region * next[MAXDIRECTIONS];
+    int i;
+    int rr;
+    int c = 0;
+    region * next[MAXDIRECTIONS];
 
-  get_neighbours(r, next);
-  /* Nachsehen, wieviele Regionen in Frage kommen */
+    get_neighbours(r, next);
+    /* Nachsehen, wieviele Regionen in Frage kommen */
 
-  for (i = 0; i != MAXDIRECTIONS; i++) {
-    if (next[i] && rterrain(next[i]) != T_OCEAN
-      && rterrain(next[i]) != T_GLACIER && rterrain(next[i]) != T_DESERT) {
-      ++c;
+    for (i = 0; i != MAXDIRECTIONS; i++) {
+        if (next[i] && rterrain(next[i]) != T_OCEAN
+            && rterrain(next[i]) != T_GLACIER && rterrain(next[i]) != T_DESERT) {
+            ++c;
+        }
     }
-  }
 
-  if (c == 0) {
+    if (c == 0) {
+        return NODIRECTION;
+    }
+    /* Zuf�llig eine ausw�hlen */
+
+    rr = rng_int() % c;
+
+    /* Durchz�hlen */
+
+    c = -1;
+    for (i = 0; i != MAXDIRECTIONS; i++) {
+        if (next[i] && rterrain(next[i]) != T_OCEAN
+            && rterrain(next[i]) != T_GLACIER && rterrain(next[i]) != T_DESERT) {
+            if (++c == rr) {
+                return (direction_t)i;
+            }
+        }
+    }
+
+    assert(!"this should never happen");               /* Bis hierhin sollte er niemals kommen. */
     return NODIRECTION;
-  }
-  /* Zuf�llig eine ausw�hlen */
-
-  rr = rng_int() % c;
-
-  /* Durchz�hlen */
-
-  c = -1;
-  for (i = 0; i != MAXDIRECTIONS; i++) {
-    if (next[i] && rterrain(next[i]) != T_OCEAN
-      && rterrain(next[i]) != T_GLACIER && rterrain(next[i]) != T_DESERT) {
-      if (++c == rr) {
-        return (direction_t)i;
-      }
-    }
-  }
-
-  assert(!"this should never happen");               /* Bis hierhin sollte er niemals kommen. */
-  return NODIRECTION;
 }
 
 static order *monster_move(region * r, unit * u)
 {
-  direction_t d = NODIRECTION;
+    direction_t d = NODIRECTION;
 
-  if (monster_is_waiting(u)) {
-    return NULL;
-  }
-  switch (old_race(u_race(u))) {
-  case RC_FIREDRAGON:
-  case RC_DRAGON:
-  case RC_WYRM:
-    d = richest_neighbour(r, u->faction, 1);
-    break;
-  case RC_TREEMAN:
-    d = treeman_neighbour(r);
-    break;
-  default:
-    d = random_neighbour(r, u);
-    break;
-  }
+    if (monster_is_waiting(u)) {
+        return NULL;
+    }
+    switch (old_race(u_race(u))) {
+    case RC_FIREDRAGON:
+    case RC_DRAGON:
+    case RC_WYRM:
+        d = richest_neighbour(r, u->faction, 1);
+        break;
+    case RC_TREEMAN:
+        d = treeman_neighbour(r);
+        break;
+    default:
+        d = random_neighbour(r, u);
+        break;
+    }
 
-  /* falls kein geld gefunden wird, zufaellig verreisen, aber nicht in
-   * den ozean */
+    /* falls kein geld gefunden wird, zufaellig verreisen, aber nicht in
+     * den ozean */
 
-  if (d == NODIRECTION)
-    return NULL;
+    if (d == NODIRECTION)
+        return NULL;
 
-  reduce_weight(u);
-  return create_order(K_MOVE, u->faction->locale, "%s",
-    LOC(u->faction->locale, directions[d]));
+    reduce_weight(u);
+    return create_order(K_MOVE, u->faction->locale, "%s",
+        LOC(u->faction->locale, directions[d]));
 }
 
 static int dragon_affinity_value(region * r, unit * u)
 {
-  int m = all_money(r, u->faction);
+    int m = all_money(r, u->faction);
 
-  if (u_race(u) == get_race(RC_FIREDRAGON)) {
-    return (int)(normalvariate(m, m / 2));
-  } else {
-    return (int)(normalvariate(m, m / 4));
-  }
+    if (u_race(u) == get_race(RC_FIREDRAGON)) {
+        return (int)(normalvariate(m, m / 2));
+    }
+    else {
+        return (int)(normalvariate(m, m / 4));
+    }
 }
 
 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;
+    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;
+    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);
+    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;
+    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 a;
-  }
-  return NULL;
+    return NULL;
 }
 
 static order *make_movement_order(unit * u, const region * target, int moves,
-  bool(*allowed) (const region *, const region *))
+    bool(*allowed) (const region *, const region *))
 {
-  region *r = u->region;
-  region **plan;
-  int bytes, position = 0;
-  char zOrder[128], *bufp = zOrder;
-  size_t size = sizeof(zOrder) - 1;
+    region *r = u->region;
+    region **plan;
+    int bytes, position = 0;
+    char zOrder[128], *bufp = zOrder;
+    size_t size = sizeof(zOrder) - 1;
 
-  if (monster_is_waiting(u))
-    return NULL;
+    if (monster_is_waiting(u))
+        return NULL;
 
-  plan = path_find(r, target, DRAGON_RANGE * 5, allowed);
-  if (plan == NULL)
-    return NULL;
+    plan = path_find(r, target, DRAGON_RANGE * 5, allowed);
+    if (plan == NULL)
+        return NULL;
 
-  bytes =
-    (int)strlcpy(bufp,
-    (const char *)LOC(u->faction->locale, keyword(K_MOVE)), size);
-  if (wrptr(&bufp, &size, bytes) != 0)
-    WARN_STATIC_BUFFER();
-
-  while (position != moves && plan[position + 1]) {
-    region *prev = plan[position];
-    region *next = plan[++position];
-    direction_t dir = reldirection(prev, next);
-    assert(dir != NODIRECTION && dir != D_SPECIAL);
-    if (size > 1) {
-      *bufp++ = ' ';
-      --size;
-    }
     bytes =
-      (int)strlcpy(bufp,
-      (const char *)LOC(u->faction->locale, directions[dir]), size);
+        (int)strlcpy(bufp,
+        (const char *)LOC(u->faction->locale, keyword(K_MOVE)), size);
     if (wrptr(&bufp, &size, bytes) != 0)
-      WARN_STATIC_BUFFER();
-  }
+        WARN_STATIC_BUFFER();
 
-  *bufp = 0;
-  return parse_order(zOrder, u->faction->locale);
+    while (position != moves && plan[position + 1]) {
+        region *prev = plan[position];
+        region *next = plan[++position];
+        direction_t dir = reldirection(prev, next);
+        assert(dir != NODIRECTION && dir != D_SPECIAL);
+        if (size > 1) {
+            *bufp++ = ' ';
+            --size;
+        }
+        bytes =
+            (int)strlcpy(bufp,
+            (const char *)LOC(u->faction->locale, directions[dir]), size);
+        if (wrptr(&bufp, &size, bytes) != 0)
+            WARN_STATIC_BUFFER();
+    }
+
+    *bufp = 0;
+    return parse_order(zOrder, u->faction->locale);
 }
 
 #ifdef TODO_ALP
 static order *monster_seeks_target(region * r, unit * u)
 {
-  direction_t d;
-  unit *target = NULL;
-  int dist, dist2;
-  direction_t i;
-  region *nr;
+    direction_t d;
+    unit *target = NULL;
+    int dist, dist2;
+    direction_t i;
+    region *nr;
 
-  /* Das Monster sucht ein bestimmtes Opfer. Welches, steht
-   * in einer Referenz/attribut
-   * derzeit gibt es nur den alp
-   */
+    /* Das Monster sucht ein bestimmtes Opfer. Welches, steht
+     * in einer Referenz/attribut
+     * derzeit gibt es nur den alp
+     */
 
-  switch (old_race(u_race(u))) {
-  case RC_ALP:
-    target = alp_target(u);
-    break;
-  default:
-    assert(!"Seeker-Monster gibt kein Ziel an");
-  }
-
-  /* TODO: pr�fen, ob target �berhaupt noch existiert... */
-  if (!target) {
-    log_error("Monster '%s' hat kein Ziel!\n", unitname(u));
-    return NULL;                /* this is a bug workaround! remove!! */
-  }
-
-  if (r == target->region) {    /* Wir haben ihn! */
-      if (u_race(u) == get_race(RC_ALP)) {
-      alp_findet_opfer(u, r);
-    } else {
-      assert(!"Seeker-Monster hat keine Aktion fuer Ziel");
+    switch (old_race(u_race(u))) {
+    case RC_ALP:
+        target = alp_target(u);
+        break;
+    default:
+        assert(!"Seeker-Monster gibt kein Ziel an");
     }
-    return NULL;
-  }
 
-  /* Simpler Ansatz: Nachbarregion mit gerinster Distanz suchen.
-   * Sinnvoll momentan nur bei Monstern, die sich nicht um das
-   * Terrain k�mmern.  Nebelw�nde & Co machen derzeit auch nix...
-   */
-  dist2 = distance(r, target->region);
-  d = NODIRECTION;
-  for (i = 0; i < MAXDIRECTIONS; i++) {
-    nr = rconnect(r, i);
-    assert(nr);
-    dist = distance(nr, target->region);
-    if (dist < dist2) {
-      dist2 = dist;
-      d = i;
+    /* TODO: pr�fen, ob target �berhaupt noch existiert... */
+    if (!target) {
+        log_error("Monster '%s' hat kein Ziel!\n", unitname(u));
+        return NULL;                /* this is a bug workaround! remove!! */
     }
-  }
-  assert(d != NODIRECTION);
 
-  return create_order(K_MOVE, u->faction->locale, "%s",
-    LOC(u->faction->locale, directions[d]));
+    if (r == target->region) {    /* Wir haben ihn! */
+        if (u_race(u) == get_race(RC_ALP)) {
+            alp_findet_opfer(u, r);
+        } else {
+            assert(!"Seeker-Monster hat keine Aktion fuer Ziel");
+        }
+        return NULL;
+    }
+
+    /* Simpler Ansatz: Nachbarregion mit gerinster Distanz suchen.
+     * Sinnvoll momentan nur bei Monstern, die sich nicht um das
+     * Terrain k�mmern.  Nebelw�nde & Co machen derzeit auch nix...
+     */
+    dist2 = distance(r, target->region);
+    d = NODIRECTION;
+    for (i = 0; i < MAXDIRECTIONS; i++) {
+        nr = rconnect(r, i);
+        assert(nr);
+        dist = distance(nr, target->region);
+        if (dist < dist2) {
+            dist2 = dist;
+            d = i;
+        }
+    }
+    assert(d != NODIRECTION);
+
+    return create_order(K_MOVE, u->faction->locale, "%s",
+        LOC(u->faction->locale, directions[d]));
 }
 #endif
 
 static void monster_attacks(unit * u)
 {
-  region *r = u->region;
-  unit *u2;
+    region *r = u->region;
+    unit *u2;
 
-  for (u2 = r->units; u2; u2 = u2->next) {
-      if (cansee(u->faction, r, u2, 0) && u2->faction != u->faction && inside_building(u2)!=u->building
-      && chance(0.75)) {
-      order *ord = monster_attack(u, u2);
-      if (ord)
-        addlist(&u->orders, ord);
+    for (u2 = r->units; u2; u2 = u2->next) {
+        if (cansee(u->faction, r, u2, 0) && u2->faction != u->faction && inside_building(u2) != u->building
+            && chance(0.75)) {
+            order *ord = monster_attack(u, u2);
+            if (ord)
+                addlist(&u->orders, ord);
+        }
     }
-  }
 }
 
 static const char *random_growl(void)
 {
-  switch (rng_int() % 5) {
-  case 0:
-    return "Groammm";
-  case 1:
-    return "Roaaarrrr";
-  case 2:
-    return "Chhhhhhhhhh";
-  case 3:
-    return "Tschrrrkk";
-  case 4:
-    return "Schhhh";
-  }
-  return "";
+    switch (rng_int() % 5) {
+    case 0:
+        return "Groammm";
+    case 1:
+        return "Roaaarrrr";
+    case 2:
+        return "Chhhhhhhhhh";
+    case 3:
+        return "Tschrrrkk";
+    case 4:
+        return "Schhhh";
+    }
+    return "";
 }
 
 extern struct attrib_type at_direction;
 
 static order *monster_learn(unit * u)
 {
-  int c = 0;
-  int n;
-  skill *sv;
-  const struct locale *lang = u->faction->locale;
+    int c = 0;
+    int n;
+    skill *sv;
+    const struct locale *lang = u->faction->locale;
 
-  /* can these monsters even study? */
-  if (!unit_can_study(u)) {
-      return NULL;
-  }
-
-  /* Monster lernt ein zuf�lliges Talent aus allen, in denen es schon
-   * Lerntage hat. */
-  for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
-    if (sv->level > 0)
-      ++c;
-  }
-
-  if (c == 0)
-    return NULL;
-
-  n = rng_int() % c + 1;
-  c = 0;
-
-  for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
-    if (sv->level > 0) {
-      if (++c == n) {
-        return create_order(K_STUDY, lang, "'%s'", skillname(sv->id, lang));
-      }
+    /* can these monsters even study? */
+    if (!unit_can_study(u)) {
+        return NULL;
     }
-  }
-  return NULL;
+
+    /* Monster lernt ein zuf�lliges Talent aus allen, in denen es schon
+     * Lerntage hat. */
+    for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
+        if (sv->level > 0)
+            ++c;
+    }
+
+    if (c == 0)
+        return NULL;
+
+    n = rng_int() % c + 1;
+    c = 0;
+
+    for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
+        if (sv->level > 0) {
+            if (++c == n) {
+                return create_order(K_STUDY, lang, "'%s'", skillname(sv->id, lang));
+            }
+        }
+    }
+    return NULL;
 }
 
 static bool check_overpopulated(unit * u)
 {
-  unit *u2;
-  int c = 0;
+    unit *u2;
+    int c = 0;
 
-  for (u2 = u->region->units; u2; u2 = u2->next) {
-    if (u_race(u2) == u_race(u) && u != u2)
-      c += u2->number;
-  }
+    for (u2 = u->region->units; u2; u2 = u2->next) {
+        if (u_race(u2) == u_race(u) && u != u2)
+            c += u2->number;
+    }
 
-  if (c > u_race(u)->splitsize * 2)
-    return true;
+    if (c > u_race(u)->splitsize * 2)
+        return true;
 
-  return false;
+    return false;
 }
 
 static void recruit_dracoids(unit * dragon, int size)
 {
-  faction *f = dragon->faction;
-  region *r = dragon->region;
-  const struct item *weapon = NULL;
-  order *new_order = NULL;
-  unit *un = create_unit(r, f, size, get_race(RC_DRACOID), 0, NULL, NULL);
+    faction *f = dragon->faction;
+    region *r = dragon->region;
+    const struct item *weapon = NULL;
+    order *new_order = NULL;
+    unit *un = create_unit(r, f, size, get_race(RC_DRACOID), 0, NULL, NULL);
 
-  fset(un, UFL_ISNEW | UFL_MOVED);
+    fset(un, UFL_ISNEW | UFL_MOVED);
 
-  name_unit(un);
-  change_money(dragon, -un->number * 50);
-  equip_unit(un, get_equipment("recruited_dracoid"));
+    name_unit(un);
+    change_money(dragon, -un->number * 50);
+    equip_unit(un, get_equipment("recruited_dracoid"));
 
-  setstatus(un, ST_FIGHT);
-  for (weapon = un->items; weapon; weapon = weapon->next) {
-    const weapon_type *wtype = weapon->type->rtype->wtype;
-    if (wtype && (wtype->flags & WTF_MISSILE)) {
-      setstatus(un, ST_BEHIND);
+    setstatus(un, ST_FIGHT);
+    for (weapon = un->items; weapon; weapon = weapon->next) {
+        const weapon_type *wtype = weapon->type->rtype->wtype;
+        if (wtype && (wtype->flags & WTF_MISSILE)) {
+            setstatus(un, ST_BEHIND);
+        }
+        new_order = create_order(K_STUDY, f->locale, "'%s'",
+            skillname(weapon->type->rtype->wtype->skill, f->locale));
     }
-    new_order = create_order(K_STUDY, f->locale, "'%s'",
-      skillname(weapon->type->rtype->wtype->skill, f->locale));
-  }
 
-  if (new_order != NULL) {
-    addlist(&un->orders, new_order);
-  }
+    if (new_order != NULL) {
+        addlist(&un->orders, new_order);
+    }
 }
 
 static order *plan_dragon(unit * u)
 {
-  attrib *ta = a_find(u->attribs, &at_targetregion);
-  region *r = u->region;
-  region *tr = NULL;
-  bool move = false;
-  order *long_order = NULL;
+    attrib *ta = a_find(u->attribs, &at_targetregion);
+    region *r = u->region;
+    region *tr = NULL;
+    bool move = false;
+    order *long_order = NULL;
 
-  reduce_weight(u);
+    reduce_weight(u);
 
-  if (ta == NULL) {
-    move |= (r->land == 0 || r->land->peasants == 0);   /* when no peasants, move */
-    move |= (r->land == 0 || r->land->money == 0);      /* when no money, move */
-  }
-  move |= chance(0.04);         /* 4% chance to change your mind */
+    if (ta == NULL) {
+        move |= (r->land == 0 || r->land->peasants == 0);   /* when no peasants, move */
+        move |= (r->land == 0 || r->land->money == 0);      /* when no money, move */
+    }
+    move |= chance(0.04);         /* 4% chance to change your mind */
 
-  if (u_race(u) == get_race(RC_WYRM) && !move) {
-    unit *u2;
-    for (u2 = r->units; u2; u2 = u2->next) {
-      /* wyrme sind einzelg�nger */
-      if (u2 == u) {
-        /* we do not make room for newcomers, so we don't need to look at them */
-        break;
-      }
-      if (u2 != u && u_race(u2) == u_race(u) && chance(0.5)) {
-        move = true;
-        break;
-      }
-    }
-  }
-
-  if (move) {
-    /* dragon gets bored and looks for a different place to go */
-    ta = set_new_dragon_target(u, u->region, DRAGON_RANGE);
-  } else
-    ta = a_find(u->attribs, &at_targetregion);
-  if (ta != NULL) {
-    tr = (region *) ta->data.v;
-    if (tr == NULL || !path_exists(u->region, tr, DRAGON_RANGE, allowed_dragon)) {
-      ta = set_new_dragon_target(u, u->region, DRAGON_RANGE);
-      if (ta)
-        tr = findregion(ta->data.sa[0], ta->data.sa[1]);
-    }
-  }
-  if (tr != NULL) {
-    assert(long_order == NULL);
-    switch (old_race(u_race(u))) {
-    case RC_FIREDRAGON:
-      long_order = make_movement_order(u, tr, 4, allowed_dragon);
-      break;
-    case RC_DRAGON:
-      long_order = make_movement_order(u, tr, 3, allowed_dragon);
-      break;
-    case RC_WYRM:
-      long_order = make_movement_order(u, tr, 1, allowed_dragon);
-      break;
-    default:
-      break;
-    }
-    if (rng_int() % 100 < 15) {
-      const struct locale *lang = u->faction->locale;
-      /* do a growl */
-      if (rname(tr, lang)) {
-        addlist(&u->orders,
-          create_order(K_MAIL, lang, "%s '%s... %s %s %s'",
-            LOC(lang, parameters[P_REGION]),
-            random_growl(),
-            u->number ==
-            1 ? "Ich rieche" : "Wir riechen",
-            "etwas in", rname(tr, u->faction->locale)));
-      }
-    }
-  } else {
-    /* we have no target. do we like it here, then? */
-    long_order = get_money_for_dragon(u->region, u, income(u));
-    if (long_order == NULL) {
-      /* money is gone, need a new target */
-      set_new_dragon_target(u, u->region, DRAGON_RANGE);
-    }
-    else if (u_race(u) != get_race(RC_FIREDRAGON)) {
-      /* neue dracoiden! */
-      if (r->land && !fval(r->terrain, FORBIDDEN_REGION)) {
-        int ra = 20 + rng_int() % 100;
-        if (get_money(u) > ra * 50 + 100 && rng_int() % 100 < 50) {
-          recruit_dracoids(u, ra);
+    if (u_race(u) == get_race(RC_WYRM) && !move) {
+        unit *u2;
+        for (u2 = r->units; u2; u2 = u2->next) {
+            /* wyrme sind einzelg�nger */
+            if (u2 == u) {
+                /* we do not make room for newcomers, so we don't need to look at them */
+                break;
+            }
+            if (u2 != u && u_race(u2) == u_race(u) && chance(0.5)) {
+                move = true;
+                break;
+            }
         }
-      }
     }
-  }
-  if (long_order == NULL) {
-    skill_t sk = SK_PERCEPTION;
-    /* study perception (or a random useful skill) */
-    while (!skill_enabled(sk) || u_race(u)->bonus[sk] < -5) {
-      sk = (skill_t) (rng_int() % MAXSKILLS);
+
+    if (move) {
+        /* dragon gets bored and looks for a different place to go */
+        ta = set_new_dragon_target(u, u->region, DRAGON_RANGE);
     }
-    long_order = create_order(K_STUDY, u->faction->locale, "'%s'",
-      skillname(sk, u->faction->locale));
-  }
-  return long_order;
+    else
+        ta = a_find(u->attribs, &at_targetregion);
+    if (ta != NULL) {
+        tr = (region *)ta->data.v;
+        if (tr == NULL || !path_exists(u->region, tr, DRAGON_RANGE, allowed_dragon)) {
+            ta = set_new_dragon_target(u, u->region, DRAGON_RANGE);
+            if (ta)
+                tr = findregion(ta->data.sa[0], ta->data.sa[1]);
+        }
+    }
+    if (tr != NULL) {
+        assert(long_order == NULL);
+        switch (old_race(u_race(u))) {
+        case RC_FIREDRAGON:
+            long_order = make_movement_order(u, tr, 4, allowed_dragon);
+            break;
+        case RC_DRAGON:
+            long_order = make_movement_order(u, tr, 3, allowed_dragon);
+            break;
+        case RC_WYRM:
+            long_order = make_movement_order(u, tr, 1, allowed_dragon);
+            break;
+        default:
+            break;
+        }
+        if (rng_int() % 100 < 15) {
+            const struct locale *lang = u->faction->locale;
+            /* do a growl */
+            if (rname(tr, lang)) {
+                addlist(&u->orders,
+                    create_order(K_MAIL, lang, "%s '%s... %s %s %s'",
+                    LOC(lang, parameters[P_REGION]),
+                    random_growl(),
+                    u->number ==
+                    1 ? "Ich rieche" : "Wir riechen",
+                    "etwas in", rname(tr, u->faction->locale)));
+            }
+        }
+    }
+    else {
+        /* we have no target. do we like it here, then? */
+        long_order = get_money_for_dragon(u->region, u, income(u));
+        if (long_order == NULL) {
+            /* money is gone, need a new target */
+            set_new_dragon_target(u, u->region, DRAGON_RANGE);
+        }
+        else if (u_race(u) != get_race(RC_FIREDRAGON)) {
+            /* neue dracoiden! */
+            if (r->land && !fval(r->terrain, FORBIDDEN_REGION)) {
+                int ra = 20 + rng_int() % 100;
+                if (get_money(u) > ra * 50 + 100 && rng_int() % 100 < 50) {
+                    recruit_dracoids(u, ra);
+                }
+            }
+        }
+    }
+    if (long_order == NULL) {
+        skill_t sk = SK_PERCEPTION;
+        /* study perception (or a random useful skill) */
+        while (!skill_enabled(sk) || u_race(u)->bonus[sk] < -5) {
+            sk = (skill_t)(rng_int() % MAXSKILLS);
+        }
+        long_order = create_order(K_STUDY, u->faction->locale, "'%s'",
+            skillname(sk, u->faction->locale));
+    }
+    return long_order;
 }
 
 void plan_monsters(faction * f)
 {
-  region *r;
+    region *r;
 
-  assert(f);
-  f->lastorders = turn;
+    assert(f);
+    f->lastorders = turn;
 
-  for (r = regions; r; r = r->next) {
-    unit *u;
-    double attack_chance = monster_attack_chance();
-    bool attacking = false;
+    for (r = regions; r; r = r->next) {
+        unit *u;
+        double attack_chance = monster_attack_chance();
+        bool attacking = false;
 
-    for (u = r->units; u; u = u->next) {
-      attrib *ta;
-      order *long_order = NULL;
+        for (u = r->units; u; u = u->next) {
+            attrib *ta;
+            order *long_order = NULL;
 
-      /* Ab hier nur noch Befehle f�r NPC-Einheiten. */
-      if (!is_monsters(u->faction))
-        continue;
+            /* Ab hier nur noch Befehle f�r NPC-Einheiten. */
+            if (!is_monsters(u->faction))
+                continue;
 
-      if (attack_chance > 0.0) {
-        if (chance(attack_chance))
-          attacking = true;
-        attack_chance = 0.0;
-      }
+            if (attack_chance > 0.0) {
+                if (chance(attack_chance))
+                    attacking = true;
+                attack_chance = 0.0;
+            }
 
-      if (u->status > ST_BEHIND) {
-        setstatus(u, ST_FIGHT);
-        /* all monsters fight */
-      }
-      if (skill_enabled(SK_PERCEPTION)) {
-        /* Monster bekommen jede Runde ein paar Tage Wahrnehmung dazu */
-        /* TODO: this only works for playerrace */
-        produceexp(u, SK_PERCEPTION, u->number);
-      }
+            if (u->status > ST_BEHIND) {
+                setstatus(u, ST_FIGHT);
+                /* all monsters fight */
+            }
+            if (skill_enabled(SK_PERCEPTION)) {
+                /* Monster bekommen jede Runde ein paar Tage Wahrnehmung dazu */
+                /* TODO: this only works for playerrace */
+                produceexp(u, SK_PERCEPTION, u->number);
+            }
 
-      /* Befehle m�ssen jede Runde neu gegeben werden: */
-      free_orders(&u->orders);
+            /* Befehle m�ssen jede Runde neu gegeben werden: */
+            free_orders(&u->orders);
 
-      if (attacking && is_guard(u, GUARD_TAX)) {
-        monster_attacks(u);
-      }
-      /* units with a plan to kill get ATTACK orders: */
-      ta = a_find(u->attribs, &at_hate);
-      if (ta && !monster_is_waiting(u)) {
-        unit *tu = (unit *) ta->data.v;
-        if (tu && tu->region == r) {
-          addlist(&u->orders,
-            create_order(K_ATTACK, u->faction->locale, "%i", tu->no));
-        } else if (tu) {
-          tu = findunitg(ta->data.i, NULL);
-          if (tu != NULL) {
-            long_order = make_movement_order(u, tu->region, 2, allowed_walk);
-          }
-        } else
-          a_remove(&u->attribs, ta);
-      }
+            if (attacking && is_guard(u, GUARD_TAX)) {
+                monster_attacks(u);
+            }
+            /* units with a plan to kill get ATTACK orders: */
+            ta = a_find(u->attribs, &at_hate);
+            if (ta && !monster_is_waiting(u)) {
+                unit *tu = (unit *)ta->data.v;
+                if (tu && tu->region == r) {
+                    addlist(&u->orders,
+                        create_order(K_ATTACK, u->faction->locale, "%i", tu->no));
+                }
+                else if (tu) {
+                    tu = findunitg(ta->data.i, NULL);
+                    if (tu != NULL) {
+                        long_order = make_movement_order(u, tu->region, 2, allowed_walk);
+                    }
+                }
+                else
+                    a_remove(&u->attribs, ta);
+            }
 
-      /* All monsters guard the region: */
-      if (!monster_is_waiting(u) && r->land) {
-        addlist(&u->orders, create_order(K_GUARD, u->faction->locale, NULL));
-      }
+            /* All monsters guard the region: */
+            if (!monster_is_waiting(u) && r->land) {
+                addlist(&u->orders, create_order(K_GUARD, u->faction->locale, NULL));
+            }
 
-      /* Einheiten mit Bewegungsplan kriegen ein NACH: */
-      if (long_order == NULL) {
-        attrib *ta = a_find(u->attribs, &at_targetregion);
-        if (ta) {
-          if (u->region == (region *) ta->data.v) {
-            a_remove(&u->attribs, ta);
-          }
-        } else if (u_race(u)->flags & RCF_MOVERANDOM) {
-          if (rng_int() % 100 < MOVECHANCE || check_overpopulated(u)) {
-            long_order = monster_move(r, u);
-          }
-        }
-      }
+            /* Einheiten mit Bewegungsplan kriegen ein NACH: */
+            if (long_order == NULL) {
+                attrib *ta = a_find(u->attribs, &at_targetregion);
+                if (ta) {
+                    if (u->region == (region *)ta->data.v) {
+                        a_remove(&u->attribs, ta);
+                    }
+                }
+                else if (u_race(u)->flags & RCF_MOVERANDOM) {
+                    if (rng_int() % 100 < MOVECHANCE || check_overpopulated(u)) {
+                        long_order = monster_move(r, u);
+                    }
+                }
+            }
 
-      if (long_order == NULL && unit_can_study(u)) {
-        /* Einheiten, die Waffenlosen Kampf lernen k�nnten, lernen es um 
-         * zu bewachen: */
-        if (u_race(u)->bonus[SK_WEAPONLESS] != -99) {
-          if (eff_skill(u, SK_WEAPONLESS, u->region) < 1) {
-            long_order =
-              create_order(K_STUDY, f->locale, "'%s'",
-              skillname(SK_WEAPONLESS, f->locale));
-          }
-        }
-      }
+            if (long_order == NULL && unit_can_study(u)) {
+                /* Einheiten, die Waffenlosen Kampf lernen k�nnten, lernen es um
+                 * zu bewachen: */
+                if (u_race(u)->bonus[SK_WEAPONLESS] != -99) {
+                    if (eff_skill(u, SK_WEAPONLESS, u->region) < 1) {
+                        long_order =
+                            create_order(K_STUDY, f->locale, "'%s'",
+                            skillname(SK_WEAPONLESS, f->locale));
+                    }
+                }
+            }
 
-      if (long_order == NULL) {
-        /* Ab hier noch nicht generalisierte Spezialbehandlungen. */
+            if (long_order == NULL) {
+                /* Ab hier noch nicht generalisierte Spezialbehandlungen. */
 
-        if (!u->orders) {
-          handle_event(u->attribs, "ai_move", u);
-        }
+                if (!u->orders) {
+                    handle_event(u->attribs, "ai_move", u);
+                }
 
-        switch (old_race(u_race(u))) {
-        case RC_SEASERPENT:
-          long_order = create_order(K_PIRACY, f->locale, NULL);
-          break;
+                switch (old_race(u_race(u))) {
+                case RC_SEASERPENT:
+                    long_order = create_order(K_PIRACY, f->locale, NULL);
+                    break;
 #ifdef TODO_ALP
-        case RC_ALP:
-          long_order = monster_seeks_target(r, u);
-          break;
+                case RC_ALP:
+                    long_order = monster_seeks_target(r, u);
+                    break;
 #endif
-        case RC_FIREDRAGON:
-        case RC_DRAGON:
-        case RC_WYRM:
-          long_order = plan_dragon(u);
-          break;
-        default:
-          if (u_race(u)->flags & RCF_LEARN) {
-            long_order = monster_learn(u);
-          }
-          break;
+                case RC_FIREDRAGON:
+                case RC_DRAGON:
+                case RC_WYRM:
+                    long_order = plan_dragon(u);
+                    break;
+                default:
+                    if (u_race(u)->flags & RCF_LEARN) {
+                        long_order = monster_learn(u);
+                    }
+                    break;
+                }
+            }
+            if (long_order) {
+                addlist(&u->orders, long_order);
+            }
         }
-      }
-      if (long_order) {
-        addlist(&u->orders, long_order);
-      }
     }
-  }
-  pathfinder_cleanup();
+    pathfinder_cleanup();
 }
 
 static double chaosfactor(region * r)
@@ -886,145 +895,146 @@ static double chaosfactor(region * r)
 
 static int nrand(int start, int sub)
 {
-  int res = 0;
+    int res = 0;
 
-  do {
-    if (rng_int() % 100 < start)
-      res++;
-    start -= sub;
-  }
-  while (start > 0);
+    do {
+        if (rng_int() % 100 < start)
+            res++;
+        start -= sub;
+    } while (start > 0);
 
-  return res;
+    return res;
 }
 
 /** Drachen und Seeschlangen k�nnen entstehen */
 void spawn_dragons(void)
 {
-  region *r;
-  faction *monsters = get_or_create_monsters();
+    region *r;
+    faction *monsters = get_or_create_monsters();
 
-  for (r = regions; r; r = r->next) {
-    unit *u;
+    for (r = regions; r; r = r->next) {
+        unit *u;
 
-    if (fval(r->terrain, SEA_REGION) && rng_int() % 10000 < 1) {
-        u = create_unit(r, monsters, 1, get_race(RC_SEASERPENT), 0, NULL, NULL);
-      fset(u, UFL_ISNEW | UFL_MOVED);
-      equip_unit(u, get_equipment("monster_seaserpent"));
+        if (fval(r->terrain, SEA_REGION) && rng_int() % 10000 < 1) {
+            u = create_unit(r, monsters, 1, get_race(RC_SEASERPENT), 0, NULL, NULL);
+            fset(u, UFL_ISNEW | UFL_MOVED);
+            equip_unit(u, get_equipment("monster_seaserpent"));
+        }
+
+        if ((r->terrain == newterrain(T_GLACIER)
+            || r->terrain == newterrain(T_SWAMP)
+            || r->terrain == newterrain(T_DESERT))
+            && rng_int() % 10000 < (5 + 100 * chaosfactor(r))) {
+            if (chance(0.80)) {
+                u = create_unit(r, monsters, nrand(60, 20) + 1, get_race(RC_FIREDRAGON), 0, NULL, NULL);
+            }
+            else {
+                u = create_unit(r, monsters, nrand(30, 20) + 1, get_race(RC_DRAGON), 0, NULL, NULL);
+            }
+            fset(u, UFL_ISNEW | UFL_MOVED);
+            equip_unit(u, get_equipment("monster_dragon"));
+
+            if (verbosity >= 2) {
+                log_printf(stdout, "%d %s in %s.\n", u->number,
+                    LOC(default_locale,
+                    rc_name_s(u_race(u), (u->number == 1) ? NAME_SINGULAR : NAME_PLURAL)), regionname(r, NULL));
+            }
+
+            name_unit(u);
+
+            /* add message to the region */
+            ADDMSG(&r->msgs,
+                msg_message("sighting", "region race number", r, u_race(u), u->number));
+        }
     }
-
-    if ((r->terrain == newterrain(T_GLACIER)
-        || r->terrain == newterrain(T_SWAMP)
-        || r->terrain == newterrain(T_DESERT))
-      && rng_int() % 10000 < (5 + 100 * chaosfactor(r))) {
-      if (chance(0.80)) {
-          u = create_unit(r, monsters, nrand(60, 20) + 1, get_race(RC_FIREDRAGON), 0, NULL, NULL);
-      } else {
-          u = create_unit(r, monsters, nrand(30, 20) + 1, get_race(RC_DRAGON), 0, NULL, NULL);
-      }
-      fset(u, UFL_ISNEW | UFL_MOVED);
-      equip_unit(u, get_equipment("monster_dragon"));
-
-      if (verbosity >= 2) {
-        log_printf(stdout, "%d %s in %s.\n", u->number,
-          LOC(default_locale,
-            rc_name_s(u_race(u), (u->number==1) ? NAME_SINGULAR:NAME_PLURAL)), regionname(r, NULL));
-      }
-
-      name_unit(u);
-
-      /* add message to the region */
-      ADDMSG(&r->msgs,
-        msg_message("sighting", "region race number", r, u_race(u), u->number));
-    }
-  }
 }
 
 /** Untote k�nnen entstehen */
 void spawn_undead(void)
 {
-  region *r;
-  faction *monsters = get_monsters();
+    region *r;
+    faction *monsters = get_monsters();
 
-  for (r = regions; r; r = r->next) {
-    int unburied = deathcount(r);
-    static const curse_type *ctype = NULL;
+    for (r = regions; r; r = r->next) {
+        int unburied = deathcount(r);
+        static const curse_type *ctype = NULL;
 
-    if (!ctype)
-      ctype = ct_find("holyground");
-    if (ctype && curse_active(get_curse(r->attribs, ctype)))
-      continue;
+        if (!ctype)
+            ctype = ct_find("holyground");
+        if (ctype && curse_active(get_curse(r->attribs, ctype)))
+            continue;
 
-    /* Chance 0.1% * chaosfactor */
-    if (r->land && unburied > r->land->peasants / 20
-      && rng_int() % 10000 < (100 + 100 * chaosfactor(r))) {
-      unit *u;
-      /* es ist sinnfrei, wenn irgendwo im Wald 3er-Einheiten Untote entstehen.
-       * Lieber sammeln lassen, bis sie mindestens 5% der Bev�lkerung sind, und
-       * dann erst auferstehen. */
-      int undead = unburied / (rng_int() % 2 + 1);
-      const race *rc = NULL;
-      int i;
-      if (r->age < 100)
-        undead = undead * r->age / 100; /* newbie-regionen kriegen weniger ab */
+        /* Chance 0.1% * chaosfactor */
+        if (r->land && unburied > r->land->peasants / 20
+            && rng_int() % 10000 < (100 + 100 * chaosfactor(r))) {
+            unit *u;
+            /* es ist sinnfrei, wenn irgendwo im Wald 3er-Einheiten Untote entstehen.
+             * Lieber sammeln lassen, bis sie mindestens 5% der Bev�lkerung sind, und
+             * dann erst auferstehen. */
+            int undead = unburied / (rng_int() % 2 + 1);
+            const race *rc = NULL;
+            int i;
+            if (r->age < 100)
+                undead = undead * r->age / 100; /* newbie-regionen kriegen weniger ab */
 
-      if (!undead || r->age < 20)
-        continue;
+            if (!undead || r->age < 20)
+                continue;
 
-      switch (rng_int() % 3) {
-      case 0:
-          rc = get_race(RC_SKELETON);
-        break;
-      case 1:
-          rc = get_race(RC_ZOMBIE);
-        break;
-      default:
-          rc = get_race(RC_GHOUL);
-        break;
-      }
+            switch (rng_int() % 3) {
+            case 0:
+                rc = get_race(RC_SKELETON);
+                break;
+            case 1:
+                rc = get_race(RC_ZOMBIE);
+                break;
+            default:
+                rc = get_race(RC_GHOUL);
+                break;
+            }
 
-      u = create_unit(r, monsters, undead, rc, 0, NULL, NULL);
-      fset(u, UFL_ISNEW | UFL_MOVED);
-      if ((rc == get_race(RC_SKELETON) || rc == get_race(RC_ZOMBIE))
-        && rng_int() % 10 < 4) {
-        equip_unit(u, get_equipment("rising_undead"));
-      }
+            u = create_unit(r, monsters, undead, rc, 0, NULL, NULL);
+            fset(u, UFL_ISNEW | UFL_MOVED);
+            if ((rc == get_race(RC_SKELETON) || rc == get_race(RC_ZOMBIE))
+                && rng_int() % 10 < 4) {
+                equip_unit(u, get_equipment("rising_undead"));
+            }
 
-      for (i = 0; i < MAXSKILLS; i++) {
-        if (rc->bonus[i] >= 1) {
-          set_level(u, (skill_t) i, 1);
-        }
-      }
-      u->hp = unit_max_hp(u) * u->number;
+            for (i = 0; i < MAXSKILLS; i++) {
+                if (rc->bonus[i] >= 1) {
+                    set_level(u, (skill_t)i, 1);
+                }
+            }
+            u->hp = unit_max_hp(u) * u->number;
 
-      deathcounts(r, -undead);
-      name_unit(u);
+            deathcounts(r, -undead);
+            name_unit(u);
 
-      if (verbosity >= 2) {
-        log_printf(stdout, "%d %s in %s.\n", u->number,
-          LOC(default_locale,
-          rc_name_s(u_race(u), (u->number == 1) ? NAME_SINGULAR : NAME_PLURAL)), regionname(r, NULL));
-      }
+            if (verbosity >= 2) {
+                log_printf(stdout, "%d %s in %s.\n", u->number,
+                    LOC(default_locale,
+                    rc_name_s(u_race(u), (u->number == 1) ? NAME_SINGULAR : NAME_PLURAL)), regionname(r, NULL));
+            }
 
       {
-        message *msg = msg_message("undeadrise", "region", r);
-        add_message(&r->msgs, msg);
-        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))
-            continue;
-          fset(u->faction, FFL_SELECT);
-          add_message(&u->faction->msgs, msg);
+          message *msg = msg_message("undeadrise", "region", r);
+          add_message(&r->msgs, msg);
+          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))
+                  continue;
+              fset(u->faction, FFL_SELECT);
+              add_message(&u->faction->msgs, msg);
+          }
+          msg_release(msg);
+      }
+        }
+        else {
+            int i = deathcount(r);
+            if (i) {
+                /* Gr�ber verwittern, 3% der Untoten finden die ewige Ruhe */
+                deathcounts(r, (int)(-i * 0.03));
+            }
         }
-        msg_release(msg);
-      }
-    } else {
-      int i = deathcount(r);
-      if (i) {
-        /* Gr�ber verwittern, 3% der Untoten finden die ewige Ruhe */
-        deathcounts(r, (int)(-i * 0.03));
-      }
     }
-  }
 }
diff --git a/src/morale.h b/src/morale.h
index aa6de5c02..c0779d0d0 100644
--- a/src/morale.h
+++ b/src/morale.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
diff --git a/src/move.c b/src/move.c
index fe500b293..b935789be 100644
--- a/src/move.c
+++ b/src/move.c
@@ -410,7 +410,7 @@ static int canride(unit * u)
     const item_type *it_horse, *it_elvenhorse, *it_charger;
     const resource_type *rtype;
 
-    it_horse = ((rtype = get_resourcetype(R_HORSE))!=NULL) ? rtype->itype : 0;
+    it_horse = ((rtype = get_resourcetype(R_HORSE)) != NULL) ? rtype->itype : 0;
     it_elvenhorse = ((rtype = get_resourcetype(R_UNICORN)) != NULL) ? rtype->itype : 0;
     it_charger = ((rtype = get_resourcetype(R_CHARGER)) != NULL) ? rtype->itype : 0;
 
@@ -907,7 +907,7 @@ static unit *bewegung_blockiert_von(unit * reisender, region * r)
                 guard_count += u->number;
                 double prob_u = (sk - stealth) * skill_prob;
                 /* amulet counts at most once */
-                prob_u += _min (1, _min(u->number, i_get(u->items, ramulet->itype))) * amulet_prob;
+                prob_u += _min(1, _min(u->number, i_get(u->items, ramulet->itype))) * amulet_prob;
                 if (u->building && (u->building->type == bt_find("castle")) && u == building_owner(u->building))
                     prob_u += castle_prob*buildingeffsize(u->building, 0);
                 if (prob_u >= prob) {
@@ -921,9 +921,9 @@ static unit *bewegung_blockiert_von(unit * reisender, region * r)
         prob += base_prob;          /* 30% base chance */
         prob = +guard_count*guard_number_prob;
         if (r->terrain == newterrain(T_GLACIER))
-            prob = +region_type_prob*2;
+            prob = +region_type_prob * 2;
         if (r->terrain == newterrain(T_SWAMP))
-            prob = +region_type_prob*2;
+            prob = +region_type_prob * 2;
         if (r->terrain == newterrain(T_MOUNTAIN))
             prob = +region_type_prob;
         if (r->terrain == newterrain(T_VOLCANO))
@@ -935,7 +935,7 @@ static unit *bewegung_blockiert_von(unit * reisender, region * r)
             return guard;
         }
     }
-  return NULL;
+    return NULL;
 }
 
 static bool is_guardian_u(const unit * guard, unit * u, unsigned int mask)
@@ -1305,8 +1305,8 @@ static void init_transportation(void)
                                 break;
                             }
                             if (getkeyword(ut->thisorder) == K_DRIVE &&
-                                    can_move(ut) && !fval(ut, UFL_NOTMOVING) &&
-                                    !LongHunger(ut)) {
+                                can_move(ut) && !fval(ut, UFL_NOTMOVING) &&
+                                !LongHunger(ut)) {
                                 unit *u2;
                                 init_order(ut->thisorder);
                                 getunit(r, ut->faction, &u2);
diff --git a/src/move.h b/src/move.h
index 3e808c769..fad44ed39 100644
--- a/src/move.h
+++ b/src/move.h
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
@@ -60,7 +60,7 @@ extern "C" {
         E_MOVE_BLOCKED              /* cannot see this region, there is a blocking connection. */
     };
     int movewhere(const struct unit *u, const char *token,
-        struct region *r, struct region **resultp);
+    struct region *r, struct region **resultp);
     direction_t reldirection(const struct region *from, const struct region *to);
 
     int personcapacity(const struct unit *u);
@@ -74,7 +74,7 @@ extern "C" {
     struct unit *get_captain(const struct ship *sh);
     void travelthru(const struct unit *u, struct region *r);
     struct ship *move_ship(struct ship *sh, struct region *from,
-        struct region *to, struct region_list *route);
+    struct region *to, struct region_list *route);
     int walkingcapacity(const struct unit *u);
     void follow_unit(struct unit *u);
     bool buildingtype_exists(const struct region *r,
diff --git a/src/names.c b/src/names.c
index 650717792..a07494593 100644
--- a/src/names.c
+++ b/src/names.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/names.h b/src/names.h
index 1bd1691d6..6aa8ce899 100644
--- a/src/names.h
+++ b/src/names.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -21,8 +21,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #ifdef __cplusplus
 extern "C" {
 #endif
-  extern void register_names(void);
-  const char *abkz(const char *s, char *buf, size_t size, size_t maxchars);
+    extern void register_names(void);
+    const char *abkz(const char *s, char *buf, size_t size, size_t maxchars);
 
 #ifdef __cplusplus
 }
diff --git a/src/platform.h b/src/platform.h
index 64c369c0a..2e5ae66f6 100644
--- a/src/platform.h
+++ b/src/platform.h
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
                          Katja Zedel <katze@felidae.kn-bremen.de
                          Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/races/dragons.c b/src/races/dragons.c
index e45d3334b..828e68c64 100644
--- a/src/races/dragons.c
+++ b/src/races/dragons.c
@@ -1,7 +1,7 @@
-/* vi: set ts=2:
+/*
  *
- * 
- * Eressea PB(E)M host Copyright (C) 1998-2003
+ *
+ * Eressea PB(E)M host Copyright (C) 1998-2015
  *      Christian Schlittchen (corwin@amber.kn-bremen.de)
  *      Katja Zedel (katze@felidae.kn-bremen.de)
  *      Henning Peters (faroul@beyond.kn-bremen.de)
@@ -30,21 +30,21 @@
 
 void age_firedragon(unit * u)
 {
-  if (u->number > 0 && rng_int() % 100 < age_chance(u->age, DRAGONAGE, 1)) {
-    double q = (double)u->hp / (double)(unit_max_hp(u) * u->number);
-    u_setrace(u, get_race(RC_DRAGON));
-    u->irace = NULL;
-    scale_number(u, 1);
-    u->hp = (int)(unit_max_hp(u) * u->number * q);
-  }
+    if (u->number > 0 && rng_int() % 100 < age_chance(u->age, DRAGONAGE, 1)) {
+        double q = (double)u->hp / (double)(unit_max_hp(u) * u->number);
+        u_setrace(u, get_race(RC_DRAGON));
+        u->irace = NULL;
+        scale_number(u, 1);
+        u->hp = (int)(unit_max_hp(u) * u->number * q);
+    }
 }
 
 void age_dragon(unit * u)
 {
-  if (u->number > 0 && rng_int() % 100 < age_chance(u->age, WYRMAGE, 1)) {
-    double q = (double)u->hp / (double)(unit_max_hp(u) * u->number);
-    u_setrace(u, get_race(RC_WYRM));
-    u->irace = NULL;
-    u->hp = (int)(unit_max_hp(u) * u->number * q);
-  }
+    if (u->number > 0 && rng_int() % 100 < age_chance(u->age, WYRMAGE, 1)) {
+        double q = (double)u->hp / (double)(unit_max_hp(u) * u->number);
+        u_setrace(u, get_race(RC_WYRM));
+        u->irace = NULL;
+        u->hp = (int)(unit_max_hp(u) * u->number * q);
+    }
 }
diff --git a/src/races/illusion.c b/src/races/illusion.c
index d6ba225c6..e2a05cfd3 100644
--- a/src/races/illusion.c
+++ b/src/races/illusion.c
@@ -1,7 +1,5 @@
-/* vi: set ts=2:
- *
- * 
- * Eressea PB(E)M host Copyright (C) 1998-2003
+/*
+ * Eressea PB(E)M host Copyright (C) 1998-2015
  *      Christian Schlittchen (corwin@amber.kn-bremen.de)
  *      Katja Zedel (katze@felidae.kn-bremen.de)
  *      Henning Peters (faroul@beyond.kn-bremen.de)
@@ -29,12 +27,13 @@
 
 void age_illusion(unit * u)
 {
-  if (u->faction->race != get_race(RC_ILLUSION)) {
-    if (u->age == ILLUSIONMAX) {
-      ADDMSG(&u->faction->msgs, msg_message("warnillusiondissolve", "unit", u));
-    } else if (u->age > ILLUSIONMAX) {
-      set_number(u, 0);
-      ADDMSG(&u->faction->msgs, msg_message("illusiondissolve", "unit", u));
+    if (u->faction->race != get_race(RC_ILLUSION)) {
+        if (u->age == ILLUSIONMAX) {
+            ADDMSG(&u->faction->msgs, msg_message("warnillusiondissolve", "unit", u));
+        }
+        else if (u->age > ILLUSIONMAX) {
+            set_number(u, 0);
+            ADDMSG(&u->faction->msgs, msg_message("illusiondissolve", "unit", u));
+        }
     }
-  }
 }
diff --git a/src/races/races.c b/src/races/races.c
index 306b65e78..38d69ac3e 100644
--- a/src/races/races.c
+++ b/src/races/races.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/*
  * +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  * |                   |  Enno Rehling <enno@eressea.de>
  * | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -40,12 +40,12 @@ void age_ghoul(struct unit *u);
 
 static void oldfamiliars(unit * u)
 {
-  char fname[64];
-  /* these familiars have no special skills.
-   */
-  _snprintf(fname, sizeof(fname), "%s_familiar", u_race(u)->_name);
-  create_mage(u, M_GRAY);
-  equip_unit(u, get_equipment(fname));
+    char fname[64];
+    /* these familiars have no special skills.
+     */
+    _snprintf(fname, sizeof(fname), "%s_familiar", u_race(u)->_name);
+    create_mage(u, M_GRAY);
+    equip_unit(u, get_equipment(fname));
 }
 
 static void equip_newunits(const struct equipment *eq, struct unit *u)
@@ -61,7 +61,7 @@ static void equip_newunits(const struct equipment *eq, struct unit *u)
         rtype = rt_find("roi");
         set_show_item(u->faction, rtype->itype);
         set_number(u, 10);
-    break;
+        break;
     case RC_HUMAN:
         if (u->building == NULL) {
             const building_type *btype = bt_find("castle");
@@ -78,44 +78,44 @@ static void equip_newunits(const struct equipment *eq, struct unit *u)
         set_show_item(u->faction, rtype->itype);
         break;
     case RC_AQUARIAN:
-        {
-            ship *sh = new_ship(st_find("boat"), r, u->faction->locale);
-            sh->size = sh->type->construction->maxsize;
-            u_set_ship(u, sh);
-        }
-        break;
+    {
+        ship *sh = new_ship(st_find("boat"), r, u->faction->locale);
+        sh->size = sh->type->construction->maxsize;
+        u_set_ship(u, sh);
+    }
+    break;
     case RC_CENTAUR:
         rsethorses(r, 250 + rng_int() % 51 + rng_int() % 51);
         break;
     default:
         break;
-  }
+    }
 }
 
 /* Die Funktionen werden �ber den hier registrierten Namen in races.xml
  * in die jeweilige Rassendefiniton eingebunden */
 void register_races(void)
 {
-  /* function initfamiliar */
-  register_function((pf_generic) oldfamiliars, "oldfamiliars");
+    /* function initfamiliar */
+    register_function((pf_generic)oldfamiliars, "oldfamiliars");
 
-  register_function((pf_generic) allowed_dragon, "movedragon");
+    register_function((pf_generic)allowed_dragon, "movedragon");
 
-  register_function((pf_generic) allowed_swim, "moveswimming");
-  register_function((pf_generic) allowed_fly, "moveflying");
-  register_function((pf_generic) allowed_walk, "movewalking");
+    register_function((pf_generic)allowed_swim, "moveswimming");
+    register_function((pf_generic)allowed_fly, "moveflying");
+    register_function((pf_generic)allowed_walk, "movewalking");
 
-  /* function age for race->age() */
-  register_function((pf_generic) age_undead, "ageundead");
-  register_function((pf_generic) age_illusion, "ageillusion");
-  register_function((pf_generic) age_skeleton, "ageskeleton");
-  register_function((pf_generic) age_zombie, "agezombie");
-  register_function((pf_generic) age_ghoul, "ageghoul");
-  register_function((pf_generic) age_dragon, "agedragon");
-  register_function((pf_generic) age_firedragon, "agefiredragon");
+    /* function age for race->age() */
+    register_function((pf_generic)age_undead, "ageundead");
+    register_function((pf_generic)age_illusion, "ageillusion");
+    register_function((pf_generic)age_skeleton, "ageskeleton");
+    register_function((pf_generic)age_zombie, "agezombie");
+    register_function((pf_generic)age_ghoul, "ageghoul");
+    register_function((pf_generic)age_dragon, "agedragon");
+    register_function((pf_generic)age_firedragon, "agefiredragon");
 
-  /* function itemdrop
-   * to generate battle spoils
-   * race->itemdrop() */
-  register_function((pf_generic) equip_newunits, "equip_newunits");
+    /* function itemdrop
+     * to generate battle spoils
+     * race->itemdrop() */
+    register_function((pf_generic)equip_newunits, "equip_newunits");
 }
diff --git a/src/races/races.h b/src/races/races.h
index ac75cb75b..c0a516430 100644
--- a/src/races/races.h
+++ b/src/races/races.h
@@ -1,11 +1,11 @@
-/* vi: set ts=2:
+/*
  * +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  * |                   |  Enno Rehling <enno@eressea.de>
  * | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
- * | (c) 1998 - 2007   |  
+ * | (c) 1998 - 2007   |
  * |                   |  This program may not be used, modified or distributed
  * +-------------------+  without prior permission by the authors of Eressea.
- *  
+ *
  */
 
 #ifndef H_RACES
@@ -15,8 +15,8 @@
 extern "C" {
 #endif
 
-  void register_races(void);
-  void make_undead_unit(struct unit *);
+    void register_races(void);
+    void make_undead_unit(struct unit *);
 
 #ifdef __cplusplus
 }
diff --git a/src/races/zombies.c b/src/races/zombies.c
index ed7ee4e86..d86074d26 100644
--- a/src/races/zombies.c
+++ b/src/races/zombies.c
@@ -1,7 +1,7 @@
-/* vi: set ts=2:
+/* 
  *
- * 
- * Eressea PB(E)M host Copyright (C) 1998-2003
+ *
+ * Eressea PB(E)M host Copyright (C) 1998-2015
  *      Christian Schlittchen (corwin@amber.kn-bremen.de)
  *      Katja Zedel (katze@felidae.kn-bremen.de)
  *      Henning Peters (faroul@beyond.kn-bremen.de)
@@ -45,61 +45,61 @@ void make_undead_unit(unit * u)
 
 void age_undead(unit * u)
 {
-  region *r = u->region;
-  int n = 0;
+    region *r = u->region;
+    int n = 0;
 
-  /* untote, die einer partei angehoeren, koennen sich
-   * absplitten, anstatt sich zu vermehren. monster
-   * untote vermehren sich nur noch */
+    /* untote, die einer partei angehoeren, koennen sich
+     * absplitten, anstatt sich zu vermehren. monster
+     * untote vermehren sich nur noch */
 
-  if (u->number > UNDEAD_MIN && !is_monsters(u->faction)
-    && rng_int() % 100 < UNDEAD_BREAKUP) {
-    int m;
-    unit *u2;
+    if (u->number > UNDEAD_MIN && !is_monsters(u->faction)
+        && rng_int() % 100 < UNDEAD_BREAKUP) {
+        int m;
+        unit *u2;
 
-    n = 0;
-    for (m = u->number; m; m--) {
-      if (rng_int() % 100 < UNDEAD_BREAKUP_FRACTION)
-        ++n;
+        n = 0;
+        for (m = u->number; m; m--) {
+            if (rng_int() % 100 < UNDEAD_BREAKUP_FRACTION)
+                ++n;
+        }
+        u2 = create_unit(r, get_monsters(), 0, get_race(RC_UNDEAD), 0, NULL, u);
+        make_undead_unit(u2);
+        transfermen(u, u2, u->number - n);
     }
-    u2 = create_unit(r, get_monsters(), 0, get_race(RC_UNDEAD), 0, NULL, u);
-    make_undead_unit(u2);
-    transfermen(u, u2, u->number - n);
-  }
 }
 
 void age_skeleton(unit * u)
 {
-  if (is_monsters(u->faction) && rng_int() % 100 < age_chance(u->age, 27, 1)) {
-    int n = _max(1, u->number / 2);
-    double q = (double)u->hp / (double)(unit_max_hp(u) * u->number);
-    u_setrace(u, get_race(RC_SKELETON_LORD));
-    u->irace = NULL;
-    scale_number(u, n);
-    u->hp = (int)(unit_max_hp(u) * u->number * q);
-  }
+    if (is_monsters(u->faction) && rng_int() % 100 < age_chance(u->age, 27, 1)) {
+        int n = _max(1, u->number / 2);
+        double q = (double)u->hp / (double)(unit_max_hp(u) * u->number);
+        u_setrace(u, get_race(RC_SKELETON_LORD));
+        u->irace = NULL;
+        scale_number(u, n);
+        u->hp = (int)(unit_max_hp(u) * u->number * q);
+    }
 }
 
 void age_zombie(unit * u)
 {
-  if (is_monsters(u->faction) && rng_int() % 100 < age_chance(u->age, 27, 1)) {
-    int n = _max(1, u->number / 2);
-    double q = (double)u->hp / (double)(unit_max_hp(u) * u->number);
-    u_setrace(u, get_race(RC_ZOMBIE_LORD));
-    u->irace = NULL;
-    scale_number(u, n);
-    u->hp = (int)(unit_max_hp(u) * u->number * q);
-  }
+    if (is_monsters(u->faction) && rng_int() % 100 < age_chance(u->age, 27, 1)) {
+        int n = _max(1, u->number / 2);
+        double q = (double)u->hp / (double)(unit_max_hp(u) * u->number);
+        u_setrace(u, get_race(RC_ZOMBIE_LORD));
+        u->irace = NULL;
+        scale_number(u, n);
+        u->hp = (int)(unit_max_hp(u) * u->number * q);
+    }
 }
 
 void age_ghoul(unit * u)
 {
-  if (is_monsters(u->faction) && rng_int() % 100 < age_chance(u->age, 27, 1)) {
-    int n = _max(1, u->number / 2);
-    double q = (double)u->hp / (double)(unit_max_hp(u) * u->number);
-    u_setrace(u, get_race(RC_GHOUL_LORD));
-    u->irace = NULL;
-    scale_number(u, n);
-    u->hp = (int)(unit_max_hp(u) * u->number * q);
-  }
+    if (is_monsters(u->faction) && rng_int() % 100 < age_chance(u->age, 27, 1)) {
+        int n = _max(1, u->number / 2);
+        double q = (double)u->hp / (double)(unit_max_hp(u) * u->number);
+        u_setrace(u, get_race(RC_GHOUL_LORD));
+        u->irace = NULL;
+        scale_number(u, n);
+        u->hp = (int)(unit_max_hp(u) * u->number * q);
+    }
 }
diff --git a/src/randenc.c b/src/randenc.c
index 0db285459..01a0c4964 100644
--- a/src/randenc.c
+++ b/src/randenc.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/randenc.h b/src/randenc.h
index be3e9d9ca..5269495da 100644
--- a/src/randenc.h
+++ b/src/randenc.h
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/report.c b/src/report.c
index efdb80268..3f2c9a1e4 100644
--- a/src/report.c
+++ b/src/report.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
@@ -375,11 +375,11 @@ static void nr_spell(FILE * F, spellbook_entry * sbe, const struct locale *lang)
             const char *vars;
         } starget;
         starget targets[] = {
-                { P_REGION, REGIONSPELL, NULL },
-                { P_UNIT, UNITSPELL, "par_unit" },
-                { P_SHIP, SHIPSPELL, "par_ship" },
-                { P_BUILDING, BUILDINGSPELL, "par_building" },
-                { 0, 0, NULL }
+            { P_REGION, REGIONSPELL, NULL },
+            { P_UNIT, UNITSPELL, "par_unit" },
+            { P_SHIP, SHIPSPELL, "par_ship" },
+            { P_BUILDING, BUILDINGSPELL, "par_building" },
+            { 0, 0, NULL }
         };
         starget *targetp;
         char cp = *params++;
@@ -828,37 +828,37 @@ static void prices(FILE * F, const region * r, const faction * f)
 
         for (dmd = r->land->demands; dmd; dmd = dmd->next)
             if (dmd->value > 0) {
-            m = msg_message("nr_market_price", "product price",
-                dmd->type->itype->rtype, dmd->value * dmd->type->price);
-            bytes = (int)nr_render(m, f->locale, bufp, size, f);
-            if (wrptr(&bufp, &size, bytes) != 0)
-                WARN_STATIC_BUFFER();
-            msg_release(m);
-            n--;
-            if (n == 0) {
-                bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_trade_end"), size);
+                m = msg_message("nr_market_price", "product price",
+                    dmd->type->itype->rtype, dmd->value * dmd->type->price);
+                bytes = (int)nr_render(m, f->locale, bufp, size, f);
                 if (wrptr(&bufp, &size, bytes) != 0)
                     WARN_STATIC_BUFFER();
-            }
-            else if (n == 1) {
-                bytes = (int)strlcpy(bufp, " ", size);
-                if (wrptr(&bufp, &size, bytes) != 0)
-                    WARN_STATIC_BUFFER();
-                bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_trade_final"), size);
-                if (wrptr(&bufp, &size, bytes) != 0)
-                    WARN_STATIC_BUFFER();
-                bytes = (int)strlcpy(bufp, " ", size);
-                if (wrptr(&bufp, &size, bytes) != 0)
-                    WARN_STATIC_BUFFER();
-            }
-            else {
-                bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_trade_next"), size);
-                if (wrptr(&bufp, &size, bytes) != 0)
-                    WARN_STATIC_BUFFER();
-                bytes = (int)strlcpy(bufp, " ", size);
-                if (wrptr(&bufp, &size, bytes) != 0)
-                    WARN_STATIC_BUFFER();
-            }
+                msg_release(m);
+                n--;
+                if (n == 0) {
+                    bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_trade_end"), size);
+                    if (wrptr(&bufp, &size, bytes) != 0)
+                        WARN_STATIC_BUFFER();
+                }
+                else if (n == 1) {
+                    bytes = (int)strlcpy(bufp, " ", size);
+                    if (wrptr(&bufp, &size, bytes) != 0)
+                        WARN_STATIC_BUFFER();
+                    bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_trade_final"), size);
+                    if (wrptr(&bufp, &size, bytes) != 0)
+                        WARN_STATIC_BUFFER();
+                    bytes = (int)strlcpy(bufp, " ", size);
+                    if (wrptr(&bufp, &size, bytes) != 0)
+                        WARN_STATIC_BUFFER();
+                }
+                else {
+                    bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_trade_next"), size);
+                    if (wrptr(&bufp, &size, bytes) != 0)
+                        WARN_STATIC_BUFFER();
+                    bytes = (int)strlcpy(bufp, " ", size);
+                    if (wrptr(&bufp, &size, bytes) != 0)
+                        WARN_STATIC_BUFFER();
+                }
             }
     }
     /* Schreibe Paragraphen */
@@ -2230,254 +2230,254 @@ const char *charset)
       }
   }
 
-    if (f->items != NULL) {
-        message *msg = msg_message("nr_claims", "items", f->items);
-        nr_render(msg, f->locale, buf, sizeof(buf), f);
-        msg_release(msg);
-        rnl(F);
-        centre(F, buf, true);
-    }
+  if (f->items != NULL) {
+      message *msg = msg_message("nr_claims", "items", f->items);
+      nr_render(msg, f->locale, buf, sizeof(buf), f);
+      msg_release(msg);
+      rnl(F);
+      centre(F, buf, true);
+  }
 
-    /* Insekten-Winter-Warnung */
-    if (f->race == get_race(RC_INSECT)) {
-        if (thisseason == 0) {
-            centre(F, LOC(f->locale, "nr_insectwinter"), true);
-            rnl(F);
-        }
-        else {
-            if (nextseason == 0) {
-                centre(F, LOC(f->locale, "nr_insectfall"), true);
-                rnl(F);
-            }
-        }
-    }
+  /* Insekten-Winter-Warnung */
+  if (f->race == get_race(RC_INSECT)) {
+      if (thisseason == 0) {
+          centre(F, LOC(f->locale, "nr_insectwinter"), true);
+          rnl(F);
+      }
+      else {
+          if (nextseason == 0) {
+              centre(F, LOC(f->locale, "nr_insectfall"), true);
+              rnl(F);
+          }
+      }
+  }
 
-    bufp = buf;
-    size = sizeof(buf) - 1;
-    bytes = _snprintf(buf, size, "%s:", LOC(f->locale, "nr_options"));
-    if (wrptr(&bufp, &size, bytes) != 0)
-        WARN_STATIC_BUFFER();
-    for (op = 0; op != MAXOPTIONS; op++) {
-        if (f->options & want(op) && options[op]) {
-            bytes = (int)strlcpy(bufp, " ", size);
-            if (wrptr(&bufp, &size, bytes) != 0)
-                WARN_STATIC_BUFFER();
-            bytes = (int)strlcpy(bufp, LOC(f->locale, options[op]), size);
-            if (wrptr(&bufp, &size, bytes) != 0)
-                WARN_STATIC_BUFFER();
+  bufp = buf;
+  size = sizeof(buf) - 1;
+  bytes = _snprintf(buf, size, "%s:", LOC(f->locale, "nr_options"));
+  if (wrptr(&bufp, &size, bytes) != 0)
+      WARN_STATIC_BUFFER();
+  for (op = 0; op != MAXOPTIONS; op++) {
+      if (f->options & want(op) && options[op]) {
+          bytes = (int)strlcpy(bufp, " ", size);
+          if (wrptr(&bufp, &size, bytes) != 0)
+              WARN_STATIC_BUFFER();
+          bytes = (int)strlcpy(bufp, LOC(f->locale, options[op]), size);
+          if (wrptr(&bufp, &size, bytes) != 0)
+              WARN_STATIC_BUFFER();
 
-            flag++;
-        }
-    }
-    if (flag > 0) {
-        rnl(F);
-        *bufp = 0;
-        centre(F, buf, true);
-    }
+          flag++;
+      }
+  }
+  if (flag > 0) {
+      rnl(F);
+      *bufp = 0;
+      centre(F, buf, true);
+  }
 
-    rp_messages(F, f->msgs, f, 0, true);
-    rp_battles(F, f);
-    a = a_find(f->attribs, &at_reportspell);
-    if (a) {
-        rnl(F);
-        centre(F, LOC(f->locale, "section_newspells"), true);
-        while (a && a->type == &at_reportspell) {
-            spellbook_entry *sbe = (spellbook_entry *)a->data.v;
-            nr_spell(F, sbe, f->locale);
-            a = a->next;
-        }
-    }
+  rp_messages(F, f->msgs, f, 0, true);
+  rp_battles(F, f);
+  a = a_find(f->attribs, &at_reportspell);
+  if (a) {
+      rnl(F);
+      centre(F, LOC(f->locale, "section_newspells"), true);
+      while (a && a->type == &at_reportspell) {
+          spellbook_entry *sbe = (spellbook_entry *)a->data.v;
+          nr_spell(F, sbe, f->locale);
+          a = a->next;
+      }
+  }
 
-    ch = 0;
-    for (a = a_find(f->attribs, &at_showitem); a && a->type == &at_showitem;
-        a = a->next) {
-        const potion_type *ptype =
-            resource2potion(((const item_type *)a->data.v)->rtype);
-        const char *description = NULL;
-        if (ptype != NULL) {
-            const char *pname = resourcename(ptype->itype->rtype, 0);
+  ch = 0;
+  for (a = a_find(f->attribs, &at_showitem); a && a->type == &at_showitem;
+      a = a->next) {
+      const potion_type *ptype =
+          resource2potion(((const item_type *)a->data.v)->rtype);
+      const char *description = NULL;
+      if (ptype != NULL) {
+          const char *pname = resourcename(ptype->itype->rtype, 0);
 
-            if (ch == 0) {
-                rnl(F);
-                centre(F, LOC(f->locale, "section_newpotions"), true);
-                ch = 1;
-            }
+          if (ch == 0) {
+              rnl(F);
+              centre(F, LOC(f->locale, "section_newpotions"), true);
+              ch = 1;
+          }
 
-            rnl(F);
-            centre(F, LOC(f->locale, pname), true);
-            _snprintf(buf, sizeof(buf), "%s %d", LOC(f->locale, "nr_level"),
-                ptype->level);
-            centre(F, buf, true);
-            rnl(F);
+          rnl(F);
+          centre(F, LOC(f->locale, pname), true);
+          _snprintf(buf, sizeof(buf), "%s %d", LOC(f->locale, "nr_level"),
+              ptype->level);
+          centre(F, buf, true);
+          rnl(F);
 
-            bufp = buf;
-            size = sizeof(buf) - 1;
-            bytes = _snprintf(bufp, size, "%s: ", LOC(f->locale, "nr_herbsrequired"));
-            if (wrptr(&bufp, &size, bytes) != 0)
-                WARN_STATIC_BUFFER();
+          bufp = buf;
+          size = sizeof(buf) - 1;
+          bytes = _snprintf(bufp, size, "%s: ", LOC(f->locale, "nr_herbsrequired"));
+          if (wrptr(&bufp, &size, bytes) != 0)
+              WARN_STATIC_BUFFER();
 
-            if (ptype->itype->construction) {
-                requirement *m = ptype->itype->construction->materials;
-                while (m->number) {
-                    bytes =
-                        (int)strlcpy(bufp, LOC(f->locale, resourcename(m->rtype, 0)), size);
-                    if (wrptr(&bufp, &size, bytes) != 0)
-                        WARN_STATIC_BUFFER();
-                    ++m;
-                    if (m->number)
-                        bytes = (int)strlcpy(bufp, ", ", size);
-                    if (wrptr(&bufp, &size, bytes) != 0)
-                        WARN_STATIC_BUFFER();
-                }
-            }
-            *bufp = 0;
-            centre(F, buf, true);
-            rnl(F);
-            if (description == NULL) {
-                const char *potiontext = mkname("potion", pname);
-                description = LOC(f->locale, potiontext);
-            }
-            centre(F, description, true);
-        }
-    }
-    rnl(F);
-    centre(F, LOC(f->locale, "nr_alliances"), false);
-    rnl(F);
+          if (ptype->itype->construction) {
+              requirement *m = ptype->itype->construction->materials;
+              while (m->number) {
+                  bytes =
+                      (int)strlcpy(bufp, LOC(f->locale, resourcename(m->rtype, 0)), size);
+                  if (wrptr(&bufp, &size, bytes) != 0)
+                      WARN_STATIC_BUFFER();
+                  ++m;
+                  if (m->number)
+                      bytes = (int)strlcpy(bufp, ", ", size);
+                  if (wrptr(&bufp, &size, bytes) != 0)
+                      WARN_STATIC_BUFFER();
+              }
+          }
+          *bufp = 0;
+          centre(F, buf, true);
+          rnl(F);
+          if (description == NULL) {
+              const char *potiontext = mkname("potion", pname);
+              description = LOC(f->locale, potiontext);
+          }
+          centre(F, description, true);
+      }
+  }
+  rnl(F);
+  centre(F, LOC(f->locale, "nr_alliances"), false);
+  rnl(F);
 
-    allies(F, f);
+  allies(F, f);
 
-    rpline(F);
+  rpline(F);
 
-    anyunits = 0;
+  anyunits = 0;
 
-    for (r = ctx->first; sr == NULL && r != ctx->last; r = r->next) {
-        sr = find_seen(ctx->seen, r);
-    }
-    for (; sr != NULL; sr = sr->next) {
-        region *r = sr->r;
-        int stealthmod = stealth_modifier(sr->mode);
-        building *b = r->buildings;
-        ship *sh = r->ships;
+  for (r = ctx->first; sr == NULL && r != ctx->last; r = r->next) {
+      sr = find_seen(ctx->seen, r);
+  }
+  for (; sr != NULL; sr = sr->next) {
+      region *r = sr->r;
+      int stealthmod = stealth_modifier(sr->mode);
+      building *b = r->buildings;
+      ship *sh = r->ships;
 
-        if (sr->mode < see_lighthouse)
-            continue;
-        /* Beschreibung */
+      if (sr->mode < see_lighthouse)
+          continue;
+      /* Beschreibung */
 
-        if (sr->mode == see_unit) {
-            anyunits = 1;
-            describe(F, sr, f);
-            if (markets_module() && r->land) {
-                const item_type *lux = r_luxury(r);
-                const item_type *herb = r->land->herbtype;
-                message *m = 0;
-                if (herb && lux) {
-                    m = msg_message("nr_market_info_p", "p1 p2",
-                        lux ? lux->rtype : 0, herb ? herb->rtype : 0);
-                }
-                else if (lux || herb) {
-                    m = msg_message("nr_market_info_s", "p1",
-                        lux ? lux->rtype : herb->rtype);
-                }
-                if (m) {
-                    rnl(F);
-                    nr_paragraph(F, m, f);
-                }
-                /*  */
-            }
-            else {
-                if (!fval(r->terrain, SEA_REGION) && rpeasants(r) / TRADE_FRACTION > 0) {
-                    rnl(F);
-                    prices(F, r, f);
-                }
-            }
-            guards(F, r, f);
-            durchreisende(F, r, f);
-        }
-        else {
-            if (sr->mode == see_far) {
-                describe(F, sr, f);
-                guards(F, r, f);
-                durchreisende(F, r, f);
-            }
-            else if (sr->mode == see_lighthouse) {
-                describe(F, sr, f);
-                durchreisende(F, r, f);
-            }
-            else {
-                describe(F, sr, f);
-                durchreisende(F, r, f);
-            }
-        }
-        /* Statistik */
+      if (sr->mode == see_unit) {
+          anyunits = 1;
+          describe(F, sr, f);
+          if (markets_module() && r->land) {
+              const item_type *lux = r_luxury(r);
+              const item_type *herb = r->land->herbtype;
+              message *m = 0;
+              if (herb && lux) {
+                  m = msg_message("nr_market_info_p", "p1 p2",
+                      lux ? lux->rtype : 0, herb ? herb->rtype : 0);
+              }
+              else if (lux || herb) {
+                  m = msg_message("nr_market_info_s", "p1",
+                      lux ? lux->rtype : herb->rtype);
+              }
+              if (m) {
+                  rnl(F);
+                  nr_paragraph(F, m, f);
+              }
+              /*  */
+          }
+          else {
+              if (!fval(r->terrain, SEA_REGION) && rpeasants(r) / TRADE_FRACTION > 0) {
+                  rnl(F);
+                  prices(F, r, f);
+              }
+          }
+          guards(F, r, f);
+          durchreisende(F, r, f);
+      }
+      else {
+          if (sr->mode == see_far) {
+              describe(F, sr, f);
+              guards(F, r, f);
+              durchreisende(F, r, f);
+          }
+          else if (sr->mode == see_lighthouse) {
+              describe(F, sr, f);
+              durchreisende(F, r, f);
+          }
+          else {
+              describe(F, sr, f);
+              durchreisende(F, r, f);
+          }
+      }
+      /* Statistik */
 
-        if (wants_stats && sr->mode == see_unit)
-            statistics(F, r, f);
+      if (wants_stats && sr->mode == see_unit)
+          statistics(F, r, f);
 
-        /* Nachrichten an REGION in der Region */
+      /* Nachrichten an REGION in der Region */
 
-        if (sr->mode == see_unit || sr->mode == see_travel) {
-            message_list *mlist = r_getmessages(r, f);
-            rp_messages(F, r->msgs, f, 0, true);
-            if (mlist)
-                rp_messages(F, mlist, f, 0, true);
-        }
+      if (sr->mode == see_unit || sr->mode == see_travel) {
+          message_list *mlist = r_getmessages(r, f);
+          rp_messages(F, r->msgs, f, 0, true);
+          if (mlist)
+              rp_messages(F, mlist, f, 0, true);
+      }
 
-        /* report all units. they are pre-sorted in an efficient manner */
-        u = r->units;
-        while (b) {
-            while (b && (!u || u->building != b)) {
-                nr_building(F, sr, b, f);
-                b = b->next;
-            }
-            if (b) {
-                nr_building(F, sr, b, f);
-                while (u && u->building == b) {
-                    nr_unit(F, f, u, 6, sr->mode);
-                    u = u->next;
-                }
-                b = b->next;
-            }
-        }
-        while (u && !u->ship) {
-            if (stealthmod > INT_MIN) {
-                if (u->faction == f || cansee(f, r, u, stealthmod)) {
-                    nr_unit(F, f, u, 4, sr->mode);
-                }
-            }
-            assert(!u->building);
-            u = u->next;
-        }
-        while (sh) {
-            while (sh && (!u || u->ship != sh)) {
-                nr_ship(F, sr, sh, f, NULL);
-                sh = sh->next;
-            }
-            if (sh) {
-                nr_ship(F, sr, sh, f, u);
-                while (u && u->ship == sh) {
-                    nr_unit(F, f, u, 6, sr->mode);
-                    u = u->next;
-                }
-                sh = sh->next;
-            }
-        }
+      /* report all units. they are pre-sorted in an efficient manner */
+      u = r->units;
+      while (b) {
+          while (b && (!u || u->building != b)) {
+              nr_building(F, sr, b, f);
+              b = b->next;
+          }
+          if (b) {
+              nr_building(F, sr, b, f);
+              while (u && u->building == b) {
+                  nr_unit(F, f, u, 6, sr->mode);
+                  u = u->next;
+              }
+              b = b->next;
+          }
+      }
+      while (u && !u->ship) {
+          if (stealthmod > INT_MIN) {
+              if (u->faction == f || cansee(f, r, u, stealthmod)) {
+                  nr_unit(F, f, u, 4, sr->mode);
+              }
+          }
+          assert(!u->building);
+          u = u->next;
+      }
+      while (sh) {
+          while (sh && (!u || u->ship != sh)) {
+              nr_ship(F, sr, sh, f, NULL);
+              sh = sh->next;
+          }
+          if (sh) {
+              nr_ship(F, sr, sh, f, u);
+              while (u && u->ship == sh) {
+                  nr_unit(F, f, u, 6, sr->mode);
+                  u = u->next;
+              }
+              sh = sh->next;
+          }
+      }
 
-        assert(!u);
+      assert(!u);
 
-        rnl(F);
-        rpline(F);
-    }
-    if (!is_monsters(f)) {
-        if (!anyunits) {
-            rnl(F);
-            rparagraph(F, LOC(f->locale, "nr_youaredead"), 0, 2, 0);
-        }
-        else {
-            list_address(F, f, ctx->addresses);
-        }
-    }
-    fclose(F);
-    return 0;
+      rnl(F);
+      rpline(F);
+  }
+  if (!is_monsters(f)) {
+      if (!anyunits) {
+          rnl(F);
+          rparagraph(F, LOC(f->locale, "nr_youaredead"), 0, 2, 0);
+      }
+      else {
+          list_address(F, f, ctx->addresses);
+      }
+  }
+  fclose(F);
+  return 0;
 }
 
 void base36conversion(void)
@@ -2572,21 +2572,21 @@ static void update_find(void)
 
     if (initial)
         for (r = regions; r; r = r->next) {
-        unit *u;
-        for (u = r->units; u; u = u->next) {
-            faction *lastf = u->faction;
-            unit *u2;
-            for (u2 = r->units; u2; u2 = u2->next) {
-                if (u2->faction == lastf || u2->faction == u->faction)
-                    continue;
-                if (seefaction(u->faction, r, u2, 0)) {
-                    faction *fv = visible_faction(u->faction, u2);
-                    lastf = fv;
-                    add_find(u->faction, u2, fv);
+            unit *u;
+            for (u = r->units; u; u = u->next) {
+                faction *lastf = u->faction;
+                unit *u2;
+                for (u2 = r->units; u2; u2 = u2->next) {
+                    if (u2->faction == lastf || u2->faction == u->faction)
+                        continue;
+                    if (seefaction(u->faction, r, u2, 0)) {
+                        faction *fv = visible_faction(u->faction, u2);
+                        lastf = fv;
+                        add_find(u->faction, u2, fv);
+                    }
                 }
             }
         }
-        }
     initial = false;
 }
 
diff --git a/src/report.h b/src/report.h
index 9f4367d9a..5f4da17a9 100644
--- a/src/report.h
+++ b/src/report.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -6,17 +6,17 @@
  |                   |  Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
  +-------------------+  Stefan Reich <reich@halbling.de>
 
- This program may not be used, modified or distributed 
+ This program may not be used, modified or distributed
  without prior permission by the authors of Eressea.
-*/
+ */
 #ifndef H_GC_REPORT
 #define H_GC_REPORT
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-  void register_nr(void);
-  void report_cleanup(void);
+    void register_nr(void);
+    void report_cleanup(void);
 
 #ifdef __cplusplus
 }
diff --git a/src/reports.c b/src/reports.c
index f770bb655..a14b059dc 100644
--- a/src/reports.c
+++ b/src/reports.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
@@ -778,15 +778,15 @@ size_t size)
             }
             if (printed < ORDERS_IN_NR)
                 for (ord = u->orders; ord; ord = ord->next) {
-                if (is_repeated(ord)) {
-                    if (printed < ORDERS_IN_NR) {
-                        bytes = (int)buforder(bufp, size, ord, printed++);
-                        if (wrptr(&bufp, &size, bytes) != 0)
-                            WARN_STATIC_BUFFER();
+                    if (is_repeated(ord)) {
+                        if (printed < ORDERS_IN_NR) {
+                            bytes = (int)buforder(bufp, size, ord, printed++);
+                            if (wrptr(&bufp, &size, bytes) != 0)
+                                WARN_STATIC_BUFFER();
+                        }
+                        else
+                            break;
                     }
-                    else
-                        break;
-                }
                 }
         }
     }
diff --git a/src/reports.h b/src/reports.h
index 60019ac2f..d5a1f3709 100644
--- a/src/reports.h
+++ b/src/reports.h
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/reports.test.c b/src/reports.test.c
index 060934ddb..3d9536ee1 100644
--- a/src/reports.test.c
+++ b/src/reports.test.c
@@ -18,67 +18,67 @@
 
 static void test_reorder_units(CuTest * tc)
 {
-  region *r;
-  building *b;
-  ship * s;
-  unit *u0, *u1, *u2, *u3, *u4;
-  struct faction * f;
-  const building_type *btype;
-  const ship_type *stype;
+    region *r;
+    building *b;
+    ship * s;
+    unit *u0, *u1, *u2, *u3, *u4;
+    struct faction * f;
+    const building_type *btype;
+    const ship_type *stype;
 
-  test_cleanup();
-  test_create_world();
+    test_cleanup();
+    test_create_world();
 
-  btype = bt_find("castle");
-  stype = st_find("boat");
+    btype = bt_find("castle");
+    stype = st_find("boat");
 
-  r = findregion(-1, 0);
-  b = test_create_building(r, btype);
-  s = test_create_ship(r, stype);
-  f = test_create_faction(0);
+    r = findregion(-1, 0);
+    b = test_create_building(r, btype);
+    s = test_create_ship(r, stype);
+    f = test_create_faction(0);
 
-  u0 = test_create_unit(f, r);
-  u_set_ship(u0, s);
-  u1 = test_create_unit(f, r);
-  u_set_ship(u1, s);
-  ship_set_owner(u1);
-  u2 = test_create_unit(f, r);
-  u3 = test_create_unit(f, r);
-  u_set_building(u3, b);
-  u4 = test_create_unit(f, r);
-  u_set_building(u4, b);
-  building_set_owner(u4);
+    u0 = test_create_unit(f, r);
+    u_set_ship(u0, s);
+    u1 = test_create_unit(f, r);
+    u_set_ship(u1, s);
+    ship_set_owner(u1);
+    u2 = test_create_unit(f, r);
+    u3 = test_create_unit(f, r);
+    u_set_building(u3, b);
+    u4 = test_create_unit(f, r);
+    u_set_building(u4, b);
+    building_set_owner(u4);
 
-  reorder_units(r);
+    reorder_units(r);
 
-  CuAssertPtrEquals(tc, u4, r->units);
-  CuAssertPtrEquals(tc, u3, u4->next);
-  CuAssertPtrEquals(tc, u2, u3->next);
-  CuAssertPtrEquals(tc, u1, u2->next);
-  CuAssertPtrEquals(tc, u0, u1->next);
-  CuAssertPtrEquals(tc, 0, u0->next);
+    CuAssertPtrEquals(tc, u4, r->units);
+    CuAssertPtrEquals(tc, u3, u4->next);
+    CuAssertPtrEquals(tc, u2, u3->next);
+    CuAssertPtrEquals(tc, u1, u2->next);
+    CuAssertPtrEquals(tc, u0, u1->next);
+    CuAssertPtrEquals(tc, 0, u0->next);
 }
 
 static void test_regionid(CuTest * tc) {
-  size_t len;
-  const struct terrain_type * plain;
-  struct region * r;
-  char buffer[64];
+    size_t len;
+    const struct terrain_type * plain;
+    struct region * r;
+    char buffer[64];
 
-  test_cleanup();
-  plain = test_create_terrain("plain", 0);
-  r = test_create_region(0, 0, plain);
+    test_cleanup();
+    plain = test_create_terrain("plain", 0);
+    r = test_create_region(0, 0, plain);
 
-  memset(buffer, 0x7d, sizeof(buffer));
-  len = f_regionid(r, 0, buffer, sizeof(buffer));
-  CuAssertIntEquals(tc, 11, len);
-  CuAssertStrEquals(tc, "plain (0,0)", buffer);
+    memset(buffer, 0x7d, sizeof(buffer));
+    len = f_regionid(r, 0, buffer, sizeof(buffer));
+    CuAssertIntEquals(tc, 11, len);
+    CuAssertStrEquals(tc, "plain (0,0)", buffer);
 
-  memset(buffer, 0x7d, sizeof(buffer));
-  len = f_regionid(r, 0, buffer, 11);
-  CuAssertIntEquals(tc, 10, len);
-  CuAssertStrEquals(tc, "plain (0,0", buffer);
-  CuAssertIntEquals(tc, 0x7d, buffer[11]);
+    memset(buffer, 0x7d, sizeof(buffer));
+    len = f_regionid(r, 0, buffer, 11);
+    CuAssertIntEquals(tc, 10, len);
+    CuAssertStrEquals(tc, "plain (0,0", buffer);
+    CuAssertIntEquals(tc, 0x7d, buffer[11]);
 }
 
 static void test_seen_faction(CuTest *tc) {
@@ -95,14 +95,14 @@ static void test_seen_faction(CuTest *tc) {
     CuAssertIntEquals(tc, 2, ql_length(f1->seen_factions));
     f2 = (faction *)ql_get(f1->seen_factions, 1);
     f1 = (faction *)ql_get(f1->seen_factions, 0);
-    CuAssertTrue(tc, f1->no<f2->no);
+    CuAssertTrue(tc, f1->no < f2->no);
 }
 
 CuSuite *get_reports_suite(void)
 {
-  CuSuite *suite = CuSuiteNew();
-  SUITE_ADD_TEST(suite, test_reorder_units);
-  SUITE_ADD_TEST(suite, test_seen_faction);
-  SUITE_ADD_TEST(suite, test_regionid);
-  return suite;
+    CuSuite *suite = CuSuiteNew();
+    SUITE_ADD_TEST(suite, test_reorder_units);
+    SUITE_ADD_TEST(suite, test_seen_faction);
+    SUITE_ADD_TEST(suite, test_regionid);
+    return suite;
 }
diff --git a/src/settings.h b/src/settings.h
index 561aae3e5..e211293b8 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
diff --git a/src/skill.c b/src/skill.c
index 0df94a85f..7b4551683 100644
--- a/src/skill.c
+++ b/src/skill.c
@@ -11,35 +11,35 @@
 #include <assert.h>
 
 const char *skillnames[MAXSKILLS] = {
-  "alchemy",
-  "crossbow",
-  "mining",
-  "bow",
-  "building",
-  "trade",
-  "forestry",
-  "catapult",
-  "herbalism",
-  "magic",
-  "training",
-  "riding",
-  "armorer",
-  "shipcraft",
-  "melee",
-  "sailing",
-  "polearm",
-  "espionage",
-  "quarrying",
-  "roadwork",
-  "tactics",
-  "stealth",
-  "entertainment",
-  "weaponsmithing",
-  "cartmaking",
-  "perception",
-  "taxation",
-  "stamina",
-  "unarmed"
+    "alchemy",
+    "crossbow",
+    "mining",
+    "bow",
+    "building",
+    "trade",
+    "forestry",
+    "catapult",
+    "herbalism",
+    "magic",
+    "training",
+    "riding",
+    "armorer",
+    "shipcraft",
+    "melee",
+    "sailing",
+    "polearm",
+    "espionage",
+    "quarrying",
+    "roadwork",
+    "tactics",
+    "stealth",
+    "entertainment",
+    "weaponsmithing",
+    "cartmaking",
+    "perception",
+    "taxation",
+    "stamina",
+    "unarmed"
 };
 
 bool skill_disabled[MAXSKILLS];
@@ -49,7 +49,7 @@ bool skill_enabled(skill_t sk) {
 }
 
 static const char * skill_key(int sk) {
-    assert(sk<MAXPARAMS && sk>=0);
+    assert(sk < MAXPARAMS && sk >= 0);
     return skill_disabled[sk] ? 0 : mkname("skill", skillnames[sk]);
 }
 
@@ -92,7 +92,7 @@ skill_t get_skill(const char *s, const struct locale * lang)
 {
     skill_t result = NOSKILL;
     char buffer[64];
-    
+
     if (s) {
         char * str = transliterate(buffer, sizeof(buffer) - sizeof(int), s);
         if (str) {
diff --git a/src/skill.h b/src/skill.h
index aa1727a4d..ad4450e74 100644
--- a/src/skill.h
+++ b/src/skill.h
@@ -4,37 +4,37 @@
 struct locale;
 
 typedef enum {
-  SK_ALCHEMY,
-  SK_CROSSBOW,
-  SK_MINING,
-  SK_LONGBOW,
-  SK_BUILDING,
-  SK_TRADE,
-  SK_LUMBERJACK,
-  SK_CATAPULT,
-  SK_HERBALISM,
-  SK_MAGIC,
-  SK_HORSE_TRAINING,            /* 10 */
-  SK_RIDING,
-  SK_ARMORER,
-  SK_SHIPBUILDING,
-  SK_MELEE,
-  SK_SAILING,
-  SK_SPEAR,
-  SK_SPY,
-  SK_QUARRYING,
-  SK_ROAD_BUILDING,
-  SK_TACTICS,                   /* 20 */
-  SK_STEALTH,
-  SK_ENTERTAINMENT,
-  SK_WEAPONSMITH,
-  SK_CARTMAKER,
-  SK_PERCEPTION,
-  SK_TAXING,
-  SK_STAMINA,
-  SK_WEAPONLESS,
-  MAXSKILLS,
-  NOSKILL = -1
+    SK_ALCHEMY,
+    SK_CROSSBOW,
+    SK_MINING,
+    SK_LONGBOW,
+    SK_BUILDING,
+    SK_TRADE,
+    SK_LUMBERJACK,
+    SK_CATAPULT,
+    SK_HERBALISM,
+    SK_MAGIC,
+    SK_HORSE_TRAINING,            /* 10 */
+    SK_RIDING,
+    SK_ARMORER,
+    SK_SHIPBUILDING,
+    SK_MELEE,
+    SK_SAILING,
+    SK_SPEAR,
+    SK_SPY,
+    SK_QUARRYING,
+    SK_ROAD_BUILDING,
+    SK_TACTICS,                   /* 20 */
+    SK_STEALTH,
+    SK_ENTERTAINMENT,
+    SK_WEAPONSMITH,
+    SK_CARTMAKER,
+    SK_PERCEPTION,
+    SK_TAXING,
+    SK_STAMINA,
+    SK_WEAPONLESS,
+    MAXSKILLS,
+    NOSKILL = -1
 } skill_t;
 
 extern const char *skillnames[];
diff --git a/src/skill.test.c b/src/skill.test.c
index 08235cf89..f2f0cd73a 100644
--- a/src/skill.test.c
+++ b/src/skill.test.c
@@ -10,7 +10,6 @@ static void test_init_skills(CuTest *tc) {
 
     test_cleanup();
     lang = get_or_create_locale("de");
-//    locale_setstring(lang, "alchemy", "Alchemie");
     init_skill(lang, SK_ALCHEMY, "Alchemie");
     CuAssertIntEquals(tc, SK_ALCHEMY, get_skill("alchemie", lang));
     test_cleanup();
@@ -48,11 +47,11 @@ static void test_get_skill_default(CuTest *tc) {
 
 CuSuite *get_skill_suite(void)
 {
-  CuSuite *suite = CuSuiteNew();
-  SUITE_ADD_TEST(suite, test_init_skill);
-  SUITE_ADD_TEST(suite, test_init_skills);
-  SUITE_ADD_TEST(suite, test_get_skill);
-  SUITE_DISABLE_TEST(suite, test_get_skill_default);
-  return suite;
+    CuSuite *suite = CuSuiteNew();
+    SUITE_ADD_TEST(suite, test_init_skill);
+    SUITE_ADD_TEST(suite, test_init_skills);
+    SUITE_ADD_TEST(suite, test_get_skill);
+    SUITE_DISABLE_TEST(suite, test_get_skill_default);
+    return suite;
 }
 
diff --git a/src/spells.c b/src/spells.c
index 9474a69cc..26bef6bd5 100644
--- a/src/spells.c
+++ b/src/spells.c
@@ -1,7 +1,7 @@
-/* vi: set ts=2:
+/* 
  *
  *
- * Eressea PB(E)M host Copyright (C) 1998-2003
+ * Eressea PB(E)M host Copyright (C) 1998-2015
  *      Christian Schlittchen (corwin@amber.kn-bremen.de)
  *      Katja Zedel (katze@felidae.kn-bremen.de)
  *      Henning Peters (faroul@beyond.kn-bremen.de)
@@ -2188,11 +2188,11 @@ static int sp_ironkeeper(castorder * co)
           tkill));
   }
 
-    msg = msg_message("summon_effect", "mage amount race", mage, 1, u_race(keeper));
-    r_addmessage(r, NULL, msg);
-    msg_release(msg);
+  msg = msg_message("summon_effect", "mage amount race", mage, 1, u_race(keeper));
+  r_addmessage(r, NULL, msg);
+  msg_release(msg);
 
-    return cast_level;
+  return cast_level;
 }
 
 /* ------------------------------------------------------------- */
@@ -2692,7 +2692,7 @@ static int sp_firewall(castorder * co)
       msg_release(unseen);
   }
 
-    return cast_level;
+  return cast_level;
 }
 
 /* ------------------------------------------------------------- */
@@ -2816,21 +2816,21 @@ static int dc_age(struct curse *c)
     up = &r->units;
     if (curse_active(c))
         while (*up != NULL) {
-        unit *u = *up;
-        double damage = c->effect * u->number;
+            unit *u = *up;
+            double damage = c->effect * u->number;
 
-        freset(u->faction, FFL_SELECT);
-        if (u->number <= 0 || target_resists_magic(mage, u, TYP_UNIT, 0)) {
-            up = &u->next;
-            continue;
-        }
+            freset(u->faction, FFL_SELECT);
+            if (u->number <= 0 || target_resists_magic(mage, u, TYP_UNIT, 0)) {
+                up = &u->next;
+                continue;
+            }
 
-        /* Reduziert durch Magieresistenz */
-        damage *= (1.0 - magic_resistance(u));
-        change_hitpoints(u, -(int)damage);
+            /* Reduziert durch Magieresistenz */
+            damage *= (1.0 - magic_resistance(u));
+            change_hitpoints(u, -(int)damage);
 
-        if (*up == u)
-            up = &u->next;
+            if (*up == u)
+                up = &u->next;
         }
 
     return AT_AGE_KEEP;
@@ -3089,7 +3089,7 @@ static bool chaosgate_valid(const connection * b)
 }
 
 static struct region *chaosgate_move(const connection * b, struct unit *u,
-    struct region *from, struct region *to, bool routing)
+struct region *from, struct region *to, bool routing)
 {
     if (!routing) {
         int maxhp = u->hp / 4;
@@ -6513,158 +6513,158 @@ typedef struct spelldata {
 
 static spelldata spell_functions[] = {
     /* M_GWYRRD */
-        { "stonegolem", sp_create_stonegolem, 0 },
-        { "irongolem", sp_create_irongolem, 0 },
-        { "treegrow", sp_hain, fumble_ents },
-        { "rustweapon", sp_rosthauch, 0 },
-        { "cold_protection", sp_kaelteschutz, 0 },
-        { "ironkeeper", sp_ironkeeper, 0 },
-        { "magicstreet", sp_magicstreet, 0 },
-        { "windshield", sp_windshield, 0 },
-        { "mallorntreegrow", sp_mallornhain, fumble_ents },
-        { "goodwinds", sp_goodwinds, 0 },
-        { "healing", sp_healing, 0 },
-        { "reelingarrows", sp_reeling_arrows, 0 },
-        { "gwyrrdfumbleshield", sp_fumbleshield, 0 },
-        { "transferauradruide", sp_transferaura, 0 },
-        { "earthquake", sp_earthquake, 0 },
-        { "stormwinds", sp_stormwinds, 0 },
-        { "homestone", sp_homestone, 0 },
-        { "wolfhowl", sp_wolfhowl, 0 },
-        { "versteinern", sp_petrify, 0 },
-        { "strongwall", sp_strong_wall, 0 },
-        { "gwyrrddestroymagic", sp_destroy_magic, 0 },
-        { "treewalkenter", sp_treewalkenter, 0 },
-        { "treewalkexit", sp_treewalkexit, 0 },
-        { "holyground", sp_holyground, 0 },
-        { "summonent", sp_summonent, 0 },
-        { "blessstonecircle", sp_blessstonecircle, 0 },
-        { "barkskin", sp_armorshield, 0 },
-        { "summonfireelemental", sp_drought, 0 },
-        { "maelstrom", sp_maelstrom, 0 },
-        { "magic_roots", sp_mallorn, 0 },
-        { "great_drought", sp_great_drought, 0 },
-        /* M_DRAIG */
-        { "sparklechaos", sp_sparkle, 0 },
-        { "magicboost", sp_magicboost, 0 },
-        { "bloodsacrifice", sp_bloodsacrifice, 0 },
-        { "berserk", sp_berserk, 0 },
-        { "fumblecurse", sp_fumblecurse, patzer_fumblecurse },
-        { "summonundead", sp_summonundead, patzer_peasantmob },
-        { "combatrust", sp_combatrosthauch, 0 },
-        { "transferaurachaos", sp_transferaura, 0 },
-        { "firewall", sp_firewall, patzer_peasantmob },
-        { "plague", sp_plague, patzer_peasantmob },
-        { "chaosrow", sp_chaosrow, 0 },
-        { "summonshadow", sp_summonshadow, patzer_peasantmob },
-        { "undeadhero", sp_undeadhero, 0 },
-        { "auraleak", sp_auraleak, 0 },
-        { "draigfumbleshield", sp_fumbleshield, 0 },
-        { "forestfire", sp_forest_fire, patzer_peasantmob },
-        { "draigdestroymagic", sp_destroy_magic, 0 },
-        { "unholypower", sp_unholypower, 0 },
-        { "deathcloud", sp_deathcloud, patzer_peasantmob },
-        { "summondragon", sp_summondragon, patzer_peasantmob },
-        { "summonshadowlords", sp_summonshadowlords, patzer_peasantmob },
-        { "chaossuction", sp_chaossuction, patzer_peasantmob },
-        /* M_ILLAUN */
-        { "sparkledream", sp_sparkle, 0 },
-        { "shadowknights", sp_shadowknights, 0 },
-        { "flee", sp_flee, 0 },
-        { "puttorest", sp_puttorest, 0 },
-        { "icastle", sp_icastle, 0 },
-        { "transferauratraum", sp_transferaura, 0 },
-        { "shapeshift", sp_illusionary_shapeshift, 0 },
-        { "dreamreading", sp_dreamreading, 0 },
-        { "tiredsoldiers", sp_tiredsoldiers, 0 },
-        { "reanimate", sp_reanimate, 0 },
-        { "analysedream", sp_analysedream, 0 },
-        { "disturbingdreams", sp_disturbingdreams, 0 },
-        { "sleep", sp_sleep, 0 },
-        { "wisps", 0, 0 }, /* this spell is gone */
-        { "gooddreams", sp_gooddreams, 0 },
-        { "illaundestroymagic", sp_destroy_magic, 0 },
-        { "clone", sp_clonecopy, 0 },
-        { "bad_dreams", sp_baddreams, 0 },
-        { "mindblast", sp_mindblast_temp, 0 },
-        { "orkdream", sp_sweetdreams, 0 },
-        { "summon_alp", sp_summon_alp, 0 },
-        /* M_CERDDOR */
-        { "appeasement", sp_denyattack, 0 },
-        { "song_of_healing", sp_healing, 0 },
-        { "generous", sp_generous, 0 },
-        { "song_of_fear", sp_flee, 0 },
-        { "courting", sp_recruit, 0 },
-        { "song_of_confusion", sp_chaosrow, 0 },
-        { "heroic_song", sp_hero, 0 },
-        { "transfer_aura_song", sp_transferaura, 0 },
-        { "analysesong_unit", sp_analysesong_unit, 0 },
-        { "cerrdorfumbleshield", sp_fumbleshield, 0 },
-        { "calm_monster", sp_calm_monster, 0 },
-        { "seduction", sp_seduce, 0 },
-        { "headache", sp_headache, 0 },
-        { "sound_out", sp_pump, 0 },
-        { "bloodthirst", sp_berserk, 0 },
-        { "frighten", sp_frighten, 0 },
-        { "analyse_object", sp_analysesong_obj, 0 },
-        { "cerddor_destroymagic", sp_destroy_magic, 0 },
-        { "migration", sp_migranten, 0 },
-        { "summon_familiar", sp_summon_familiar, 0 },
-        { "raise_mob", sp_raisepeasants, 0 },
-        { "song_resist_magic", sp_song_resistmagic, 0 },
-        { "melancholy", sp_depression, 0 },
-        { "song_suscept_magic", sp_song_susceptmagic, 0 },
-        { "song_of_peace", sp_song_of_peace, 0 },
-        { "song_of_slavery", sp_charmingsong, 0 },
-        { "big_recruit", sp_bigrecruit, 0 },
-        { "calm_riot", sp_rallypeasantmob, 0 },
-        { "incite_riot", sp_raisepeasantmob, 0 },
-        /* M_TYBIED */
-        { "analyze_magic", sp_analysemagic, 0 },
-        { "concealing_aura", sp_itemcloak, 0 },
-        { "tybiedfumbleshield", sp_fumbleshield, 0 },
+    { "stonegolem", sp_create_stonegolem, 0 },
+    { "irongolem", sp_create_irongolem, 0 },
+    { "treegrow", sp_hain, fumble_ents },
+    { "rustweapon", sp_rosthauch, 0 },
+    { "cold_protection", sp_kaelteschutz, 0 },
+    { "ironkeeper", sp_ironkeeper, 0 },
+    { "magicstreet", sp_magicstreet, 0 },
+    { "windshield", sp_windshield, 0 },
+    { "mallorntreegrow", sp_mallornhain, fumble_ents },
+    { "goodwinds", sp_goodwinds, 0 },
+    { "healing", sp_healing, 0 },
+    { "reelingarrows", sp_reeling_arrows, 0 },
+    { "gwyrrdfumbleshield", sp_fumbleshield, 0 },
+    { "transferauradruide", sp_transferaura, 0 },
+    { "earthquake", sp_earthquake, 0 },
+    { "stormwinds", sp_stormwinds, 0 },
+    { "homestone", sp_homestone, 0 },
+    { "wolfhowl", sp_wolfhowl, 0 },
+    { "versteinern", sp_petrify, 0 },
+    { "strongwall", sp_strong_wall, 0 },
+    { "gwyrrddestroymagic", sp_destroy_magic, 0 },
+    { "treewalkenter", sp_treewalkenter, 0 },
+    { "treewalkexit", sp_treewalkexit, 0 },
+    { "holyground", sp_holyground, 0 },
+    { "summonent", sp_summonent, 0 },
+    { "blessstonecircle", sp_blessstonecircle, 0 },
+    { "barkskin", sp_armorshield, 0 },
+    { "summonfireelemental", sp_drought, 0 },
+    { "maelstrom", sp_maelstrom, 0 },
+    { "magic_roots", sp_mallorn, 0 },
+    { "great_drought", sp_great_drought, 0 },
+    /* M_DRAIG */
+    { "sparklechaos", sp_sparkle, 0 },
+    { "magicboost", sp_magicboost, 0 },
+    { "bloodsacrifice", sp_bloodsacrifice, 0 },
+    { "berserk", sp_berserk, 0 },
+    { "fumblecurse", sp_fumblecurse, patzer_fumblecurse },
+    { "summonundead", sp_summonundead, patzer_peasantmob },
+    { "combatrust", sp_combatrosthauch, 0 },
+    { "transferaurachaos", sp_transferaura, 0 },
+    { "firewall", sp_firewall, patzer_peasantmob },
+    { "plague", sp_plague, patzer_peasantmob },
+    { "chaosrow", sp_chaosrow, 0 },
+    { "summonshadow", sp_summonshadow, patzer_peasantmob },
+    { "undeadhero", sp_undeadhero, 0 },
+    { "auraleak", sp_auraleak, 0 },
+    { "draigfumbleshield", sp_fumbleshield, 0 },
+    { "forestfire", sp_forest_fire, patzer_peasantmob },
+    { "draigdestroymagic", sp_destroy_magic, 0 },
+    { "unholypower", sp_unholypower, 0 },
+    { "deathcloud", sp_deathcloud, patzer_peasantmob },
+    { "summondragon", sp_summondragon, patzer_peasantmob },
+    { "summonshadowlords", sp_summonshadowlords, patzer_peasantmob },
+    { "chaossuction", sp_chaossuction, patzer_peasantmob },
+    /* M_ILLAUN */
+    { "sparkledream", sp_sparkle, 0 },
+    { "shadowknights", sp_shadowknights, 0 },
+    { "flee", sp_flee, 0 },
+    { "puttorest", sp_puttorest, 0 },
+    { "icastle", sp_icastle, 0 },
+    { "transferauratraum", sp_transferaura, 0 },
+    { "shapeshift", sp_illusionary_shapeshift, 0 },
+    { "dreamreading", sp_dreamreading, 0 },
+    { "tiredsoldiers", sp_tiredsoldiers, 0 },
+    { "reanimate", sp_reanimate, 0 },
+    { "analysedream", sp_analysedream, 0 },
+    { "disturbingdreams", sp_disturbingdreams, 0 },
+    { "sleep", sp_sleep, 0 },
+    { "wisps", 0, 0 }, /* this spell is gone */
+    { "gooddreams", sp_gooddreams, 0 },
+    { "illaundestroymagic", sp_destroy_magic, 0 },
+    { "clone", sp_clonecopy, 0 },
+    { "bad_dreams", sp_baddreams, 0 },
+    { "mindblast", sp_mindblast_temp, 0 },
+    { "orkdream", sp_sweetdreams, 0 },
+    { "summon_alp", sp_summon_alp, 0 },
+    /* M_CERDDOR */
+    { "appeasement", sp_denyattack, 0 },
+    { "song_of_healing", sp_healing, 0 },
+    { "generous", sp_generous, 0 },
+    { "song_of_fear", sp_flee, 0 },
+    { "courting", sp_recruit, 0 },
+    { "song_of_confusion", sp_chaosrow, 0 },
+    { "heroic_song", sp_hero, 0 },
+    { "transfer_aura_song", sp_transferaura, 0 },
+    { "analysesong_unit", sp_analysesong_unit, 0 },
+    { "cerrdorfumbleshield", sp_fumbleshield, 0 },
+    { "calm_monster", sp_calm_monster, 0 },
+    { "seduction", sp_seduce, 0 },
+    { "headache", sp_headache, 0 },
+    { "sound_out", sp_pump, 0 },
+    { "bloodthirst", sp_berserk, 0 },
+    { "frighten", sp_frighten, 0 },
+    { "analyse_object", sp_analysesong_obj, 0 },
+    { "cerddor_destroymagic", sp_destroy_magic, 0 },
+    { "migration", sp_migranten, 0 },
+    { "summon_familiar", sp_summon_familiar, 0 },
+    { "raise_mob", sp_raisepeasants, 0 },
+    { "song_resist_magic", sp_song_resistmagic, 0 },
+    { "melancholy", sp_depression, 0 },
+    { "song_suscept_magic", sp_song_susceptmagic, 0 },
+    { "song_of_peace", sp_song_of_peace, 0 },
+    { "song_of_slavery", sp_charmingsong, 0 },
+    { "big_recruit", sp_bigrecruit, 0 },
+    { "calm_riot", sp_rallypeasantmob, 0 },
+    { "incite_riot", sp_raisepeasantmob, 0 },
+    /* M_TYBIED */
+    { "analyze_magic", sp_analysemagic, 0 },
+    { "concealing_aura", sp_itemcloak, 0 },
+    { "tybiedfumbleshield", sp_fumbleshield, 0 },
 #ifdef SHOWASTRAL_NOT_BORKED
-        { "show_astral", sp_showastral, 0},
+    { "show_astral", sp_showastral, 0},
 #endif
-        { "resist_magic", sp_resist_magic_bonus, 0 },
-        { "keeploot", sp_keeploot, 0 },
-        { "enterastral", sp_enterastral, 0 },
-        { "leaveastral", sp_leaveastral, 0 },
-        { "auratransfer", sp_transferaura, 0 },
-        { "shockwave", sp_stun, 0 },
-        { "antimagiczone", sp_antimagiczone, 0 },
-        { "destroy_magic", sp_destroy_magic, 0 },
-        { "pull_astral", sp_pullastral, 0 },
-        { "fetch_astral", sp_fetchastral, 0 },
-        { "steal_aura", sp_stealaura, 0 },
-        { "airship", sp_flying_ship, 0 },
-        { "break_curse", sp_break_curse, 0 },
-        { "eternal_walls", sp_eternizewall, 0 },
-        { "protective_runes", sp_magicrunes, 0 },
-        { "fish_shield", sp_reduceshield, 0 },
-        { "combat_speed", sp_speed, 0 },
-        { "view_reality", sp_viewreality, 0 },
-        { "double_time", sp_speed2, 0 },
-        { "armor_shield", sp_armorshield, 0 },
-        { "living_rock", sp_movecastle, 0 },
-        { "astral_disruption", sp_disruptastral, 0 },
-        { "sacrifice_strength", sp_permtransfer, 0 },
-        /* M_GRAY */
-        /*  Definitionen von Create_Artefaktspruechen    */
-        { "wyrm_transformation", sp_becomewyrm, 0 },
-        /* Monstersprueche */
-        { "fiery_dragonbreath", sp_dragonodem, 0 },
-        { "icy_dragonbreath", sp_dragonodem, 0 },
-        { "powerful_dragonbreath", sp_dragonodem, 0 },
-        { "drain_skills", sp_dragonodem, 0 },
-        { "aura_of_fear", sp_flee, 0 },
-        { "shadowcall", sp_shadowcall, 0 },
-        { "immolation", sp_immolation, 0 },
-        { "firestorm", sp_immolation, 0 },
-        { "coldfront", sp_immolation, 0 },
-        { "acidrain", sp_immolation, 0 },
-        /* SPL_NOSPELL  MUSS der letzte Spruch der Liste sein */
-        { 0, 0, 0 }
+    { "resist_magic", sp_resist_magic_bonus, 0 },
+    { "keeploot", sp_keeploot, 0 },
+    { "enterastral", sp_enterastral, 0 },
+    { "leaveastral", sp_leaveastral, 0 },
+    { "auratransfer", sp_transferaura, 0 },
+    { "shockwave", sp_stun, 0 },
+    { "antimagiczone", sp_antimagiczone, 0 },
+    { "destroy_magic", sp_destroy_magic, 0 },
+    { "pull_astral", sp_pullastral, 0 },
+    { "fetch_astral", sp_fetchastral, 0 },
+    { "steal_aura", sp_stealaura, 0 },
+    { "airship", sp_flying_ship, 0 },
+    { "break_curse", sp_break_curse, 0 },
+    { "eternal_walls", sp_eternizewall, 0 },
+    { "protective_runes", sp_magicrunes, 0 },
+    { "fish_shield", sp_reduceshield, 0 },
+    { "combat_speed", sp_speed, 0 },
+    { "view_reality", sp_viewreality, 0 },
+    { "double_time", sp_speed2, 0 },
+    { "armor_shield", sp_armorshield, 0 },
+    { "living_rock", sp_movecastle, 0 },
+    { "astral_disruption", sp_disruptastral, 0 },
+    { "sacrifice_strength", sp_permtransfer, 0 },
+    /* M_GRAY */
+    /*  Definitionen von Create_Artefaktspruechen    */
+    { "wyrm_transformation", sp_becomewyrm, 0 },
+    /* Monstersprueche */
+    { "fiery_dragonbreath", sp_dragonodem, 0 },
+    { "icy_dragonbreath", sp_dragonodem, 0 },
+    { "powerful_dragonbreath", sp_dragonodem, 0 },
+    { "drain_skills", sp_dragonodem, 0 },
+    { "aura_of_fear", sp_flee, 0 },
+    { "shadowcall", sp_shadowcall, 0 },
+    { "immolation", sp_immolation, 0 },
+    { "firestorm", sp_immolation, 0 },
+    { "coldfront", sp_immolation, 0 },
+    { "acidrain", sp_immolation, 0 },
+    /* SPL_NOSPELL  MUSS der letzte Spruch der Liste sein */
+    { 0, 0, 0 }
 };
 
 static void register_spelldata(void)
diff --git a/src/spells.h b/src/spells.h
index 6ec0516ed..a23558e96 100644
--- a/src/spells.h
+++ b/src/spells.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  *
  *
  * Eressea PB(E)M host Copyright (C) 1998-2003
@@ -18,18 +18,18 @@
 extern "C" {
 #endif
 
-  struct ship;
-  struct curse;
-  struct unit;
-  struct message;
+    struct ship;
+    struct curse;
+    struct unit;
+    struct message;
 
-  void register_spells(void);
-  void set_spelldata(struct spell *sp);
+    void register_spells(void);
+    void set_spelldata(struct spell *sp);
 
 #define ACTION_RESET      0x01  /* reset the one-time-flag FFL_SELECT (on first pass) */
 #define ACTION_CANSEE     0x02  /* to people who can see the actor */
 #define ACTION_CANNOTSEE  0x04  /* to people who can not see the actor */
-  int report_action(struct region *r, struct unit *actor, struct message *msg, int flags);
+    int report_action(struct region *r, struct unit *actor, struct message *msg, int flags);
 
 #ifdef __cplusplus
 }
diff --git a/src/spells/alp.c b/src/spells/alp.c
index 73d17662a..f86695194 100644
--- a/src/spells/alp.c
+++ b/src/spells/alp.c
@@ -1,6 +1,6 @@
-/* vi: set ts=2:
+/*
  *
- * Eressea PB(E)M host Copyright (C) 1998-2003
+ * Eressea PB(E)M host Copyright (C) 1998-2015
  *      Christian Schlittchen (corwin@amber.kn-bremen.de)
  *      Katja Zedel (katze@felidae.kn-bremen.de)
  *      Henning Peters (faroul@beyond.kn-bremen.de)
@@ -45,94 +45,94 @@
 extern const char *directions[];
 
 typedef struct alp_data {
-  unit *mage;
-  unit *target;
+    unit *mage;
+    unit *target;
 } alp_data;
 
 static void alp_init(attrib * a)
 {
-  a->data.v = calloc(sizeof(alp_data), 1);
+    a->data.v = calloc(sizeof(alp_data), 1);
 }
 
 static void alp_done(attrib * a)
 {
-  free(a->data.v);
+    free(a->data.v);
 }
 
 static int alp_verify(attrib * a)
 {
-  alp_data *ad = (alp_data *) a->data.v;
-  if (ad->mage && ad->target)
-    return 1;
-  return 0;                     /* remove the attribute */
+    alp_data *ad = (alp_data *)a->data.v;
+    if (ad->mage && ad->target)
+        return 1;
+    return 0;                     /* remove the attribute */
 }
 
 static void
 alp_write(const attrib * a, const void *owner, struct storage *store)
 {
-  alp_data *ad = (alp_data *) a->data.v;
-  write_unit_reference(ad->mage, store);
-  write_unit_reference(ad->target, store);
+    alp_data *ad = (alp_data *)a->data.v;
+    write_unit_reference(ad->mage, store);
+    write_unit_reference(ad->target, store);
 }
 
 static int alp_read(attrib * a, void *owner, struct storage *store)
 {
-  alp_data *ad = (alp_data *) a->data.v;
-  int rm = read_reference(&ad->mage, store, read_unit_reference, resolve_unit);
-  int rt =
-    read_reference(&ad->target, store, read_unit_reference, resolve_unit);
-  if (rt == 0 && rm == 0 && (!ad->target || !ad->mage)) {
-    /* the target or mage disappeared. */
-    return AT_READ_FAIL;
-  }
-  return AT_READ_OK;
+    alp_data *ad = (alp_data *)a->data.v;
+    int rm = read_reference(&ad->mage, store, read_unit_reference, resolve_unit);
+    int rt =
+        read_reference(&ad->target, store, read_unit_reference, resolve_unit);
+    if (rt == 0 && rm == 0 && (!ad->target || !ad->mage)) {
+        /* the target or mage disappeared. */
+        return AT_READ_FAIL;
+    }
+    return AT_READ_OK;
 }
 
 static attrib_type at_alp = {
-  "alp",
-  alp_init,
-  alp_done,
-  alp_verify,
-  alp_write,
-  alp_read,
-  ATF_UNIQUE
+    "alp",
+    alp_init,
+    alp_done,
+    alp_verify,
+    alp_write,
+    alp_read,
+    ATF_UNIQUE
 };
 
 int sp_summon_alp(struct castorder *co)
 {
-  unit *alp, *opfer;
-  region *r = co_get_region(co);
-  unit *mage = co->magician.u;
-  int cast_level = co->level;
-  spellparameter *pa = co->par;
-  const struct race *rc = get_race(RC_ALP);
-  struct faction *f = get_monsters();
-  struct message *msg;
+    unit *alp, *opfer;
+    region *r = co_get_region(co);
+    unit *mage = co->magician.u;
+    int cast_level = co->level;
+    spellparameter *pa = co->par;
+    const struct race *rc = get_race(RC_ALP);
+    struct faction *f = get_monsters();
+    struct message *msg;
 
-  opfer = pa->param[0]->data.u;
+    opfer = pa->param[0]->data.u;
 
-  /* Der Alp geh�rt den Monstern, darum erh�lt der Magier auch keine
-   * Regionsberichte von ihm.  Er erh�lt aber sp�ter eine Mitteilung,
-   * sobald der Alp sein Opfer erreicht hat.
-   */
-  alp = create_unit(r, f, 1, rc, 0, NULL, NULL);
-  set_level(alp, SK_STEALTH, 7);
-  setstatus(alp, ST_FLEE);      /* flieht */
+    /* Der Alp geh�rt den Monstern, darum erh�lt der Magier auch keine
+     * Regionsberichte von ihm.  Er erh�lt aber sp�ter eine Mitteilung,
+     * sobald der Alp sein Opfer erreicht hat.
+     */
+    alp = create_unit(r, f, 1, rc, 0, NULL, NULL);
+    set_level(alp, SK_STEALTH, 7);
+    setstatus(alp, ST_FLEE);      /* flieht */
+
+    {
+        attrib *a = a_add(&alp->attribs, a_new(&at_alp));
+        alp_data *ad = (alp_data *)a->data.v;
+        ad->mage = mage;
+        ad->target = opfer;
+    }
 
   {
-    attrib *a = a_add(&alp->attribs, a_new(&at_alp));
-    alp_data *ad = (alp_data *) a->data.v;
-    ad->mage = mage;
-    ad->target = opfer;
-  }
-
-  {
-    /* Wenn der Alp stirbt, den Magier nachrichtigen */
-    add_trigger(&alp->attribs, "destroy", trigger_unitmessage(mage,
-        "trigger_alp_destroy", MSG_EVENT, ML_INFO));
-    /* Wenn Opfer oder Magier nicht mehr existieren, dann stirbt der Alp */
-    add_trigger(&mage->attribs, "destroy", trigger_killunit(alp));
-    add_trigger(&opfer->attribs, "destroy", trigger_killunit(alp));
+      /* Wenn der Alp stirbt, den Magier nachrichtigen */
+      add_trigger(&alp->attribs, "destroy", trigger_unitmessage(mage,
+          "trigger_alp_destroy", MSG_EVENT, ML_INFO));
+      /* Wenn Opfer oder Magier nicht mehr existieren, dann stirbt der Alp */
+      add_trigger(&mage->attribs, "destroy", trigger_killunit(alp));
+      add_trigger(&opfer->attribs, "destroy", trigger_killunit(alp));
   }
   msg = msg_message("summon_alp_effect", "mage alp target", mage, alp, opfer);
   r_addmessage(r, mage->faction, msg);
@@ -143,59 +143,59 @@ int sp_summon_alp(struct castorder *co)
 
 void alp_findet_opfer(unit * alp, region * r)
 {
-  curse *c;
-  attrib *a = a_find(alp->attribs, &at_alp);
-  alp_data *ad = (alp_data *) a->data.v;
-  unit *mage = ad->mage;
-  unit *opfer = ad->target;
-  float effect;
-  message *msg;
+    curse *c;
+    attrib *a = a_find(alp->attribs, &at_alp);
+    alp_data *ad = (alp_data *)a->data.v;
+    unit *mage = ad->mage;
+    unit *opfer = ad->target;
+    float effect;
+    message *msg;
 
-  assert(opfer);
-  assert(mage);
+    assert(opfer);
+    assert(mage);
 
-  /* Magier und Opfer Bescheid geben */
-  msg = msg_message("alp_success", "target", opfer);
-  add_message(&mage->faction->msgs, msg);
-  r_addmessage(opfer->region, opfer->faction, msg);
-  msg_release(msg);
+    /* Magier und Opfer Bescheid geben */
+    msg = msg_message("alp_success", "target", opfer);
+    add_message(&mage->faction->msgs, msg);
+    r_addmessage(opfer->region, opfer->faction, msg);
+    msg_release(msg);
 
-  /* Relations werden in destroy_unit(alp) automatisch gel�scht.
-   * Die Aktionen, die beim Tod des Alps ausgel�st werden sollen,
-   * m�ssen jetzt aber deaktiviert werden, sonst werden sie gleich
-   * beim destroy_unit(alp) ausgel�st.
-   */
-  a_removeall(&alp->attribs, &at_eventhandler);
+    /* Relations werden in destroy_unit(alp) automatisch gel�scht.
+     * Die Aktionen, die beim Tod des Alps ausgel�st werden sollen,
+     * m�ssen jetzt aber deaktiviert werden, sonst werden sie gleich
+     * beim destroy_unit(alp) ausgel�st.
+     */
+    a_removeall(&alp->attribs, &at_eventhandler);
 
-  /* Alp umwandeln in Curse */
-  effect = -2;
-  c =
-    create_curse(mage, &opfer->attribs, ct_find("worse"), 2, 2, effect,
-    opfer->number);
-  /* solange es noch keine spezielle alp-Antimagie gibt, reagiert der
-   * auch auf normale */
-  set_number(alp, 0);
+    /* Alp umwandeln in Curse */
+    effect = -2;
+    c =
+        create_curse(mage, &opfer->attribs, ct_find("worse"), 2, 2, effect,
+        opfer->number);
+    /* solange es noch keine spezielle alp-Antimagie gibt, reagiert der
+     * auch auf normale */
+    set_number(alp, 0);
 
-  /* wenn der Magier stirbt, wird der Curse wieder vom Opfer genommen */
-  add_trigger(&mage->attribs, "destroy", trigger_removecurse(c, opfer));
+    /* wenn der Magier stirbt, wird der Curse wieder vom Opfer genommen */
+    add_trigger(&mage->attribs, "destroy", trigger_removecurse(c, opfer));
 }
 
 void register_alp(void)
 {
-  at_register(&at_alp);
+    at_register(&at_alp);
 }
 
 unit *alp_target(unit * alp)
 {
-  alp_data *ad;
-  unit *target = NULL;
+    alp_data *ad;
+    unit *target = NULL;
 
-  attrib *a = a_find(alp->attribs, &at_alp);
+    attrib *a = a_find(alp->attribs, &at_alp);
 
-  if (a) {
-    ad = (alp_data *) a->data.v;
-    target = ad->target;
-  }
-  return target;
+    if (a) {
+        ad = (alp_data *)a->data.v;
+        target = ad->target;
+    }
+    return target;
 
 }
diff --git a/src/spells/alp.h b/src/spells/alp.h
index c350e7c7d..f30cc1837 100644
--- a/src/spells/alp.h
+++ b/src/spells/alp.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  *
  *
  * Eressea PB(E)M host Copyright (C) 1998-2003
@@ -18,34 +18,34 @@
 extern "C" {
 #endif
 
-  struct castorder;
-  struct region;
-  struct unit;
-/* ------------------------------------------------------------- */
-/* Name:		Alp
- * Stufe:		15
- * Gebiet:  Illaun
- * Wirkung:
- * Erschafft ein kleines Monster (den Alp).  Dieser bewegt sich jede
- * zweite Runde auf eine Zieleinheit zu.  Sobald das Ziel erreicht ist,
- * verwandelt es sich in einen Curse auf die Einheit, welches -2 auf
- * alle Talente bewirkt.
- *
- * F�higkeiten (factypes.c):
- * Der Alp hat mittlere Tarnung (T7) und exzellente Verteidigung
- * (+20, 99% Magieresistenz, siehe factypes.c)
- *
- * TODO: Der Alp-Curse sollte sich durch besondere Antimagie (Tybied)
- * entfernen lassen.
- *
- * (UNITSPELL | SEARCHGLOBAL | TESTRESISTANCE)
- */
+    struct castorder;
+    struct region;
+    struct unit;
+    /* ------------------------------------------------------------- */
+    /* Name:		Alp
+     * Stufe:		15
+     * Gebiet:  Illaun
+     * Wirkung:
+     * Erschafft ein kleines Monster (den Alp).  Dieser bewegt sich jede
+     * zweite Runde auf eine Zieleinheit zu.  Sobald das Ziel erreicht ist,
+     * verwandelt es sich in einen Curse auf die Einheit, welches -2 auf
+     * alle Talente bewirkt.
+     *
+     * F�higkeiten (factypes.c):
+     * Der Alp hat mittlere Tarnung (T7) und exzellente Verteidigung
+     * (+20, 99% Magieresistenz, siehe factypes.c)
+     *
+     * TODO: Der Alp-Curse sollte sich durch besondere Antimagie (Tybied)
+     * entfernen lassen.
+     *
+     * (UNITSPELL | SEARCHGLOBAL | TESTRESISTANCE)
+     */
 
-  extern int sp_summon_alp(struct castorder *co);
-  extern void register_alp(void);
+    extern int sp_summon_alp(struct castorder *co);
+    extern void register_alp(void);
 
-  struct unit *alp_target(struct unit *alp);
-  void alp_findet_opfer(struct unit *alp, struct region *r);
+    struct unit *alp_target(struct unit *alp);
+    void alp_findet_opfer(struct unit *alp, struct region *r);
 
 #ifdef __cplusplus
 }
diff --git a/src/spells/borders.c b/src/spells/borders.c
index 41eca0bd1..5994e2b14 100644
--- a/src/spells/borders.c
+++ b/src/spells/borders.c
@@ -25,49 +25,49 @@
 #include <stdlib.h>
 
 typedef struct wallcurse {
-  curse *buddy;
-  connection *wall;
+    curse *buddy;
+    connection *wall;
 } wallcurse;
 
 void cw_init(attrib * a)
 {
-  curse *c;
-  curse_init(a);
-  c = (curse *) a->data.v;
-  c->data.v = calloc(sizeof(wallcurse), 1);
+    curse *c;
+    curse_init(a);
+    c = (curse *)a->data.v;
+    c->data.v = calloc(sizeof(wallcurse), 1);
 }
 
 void cw_write(const attrib * a, const void *target, storage * store)
 {
-  connection *b = ((wallcurse *) ((curse *) a->data.v)->data.v)->wall;
-  curse_write(a, target, store);
-  WRITE_INT(store, b->id);
+    connection *b = ((wallcurse *)((curse *)a->data.v)->data.v)->wall;
+    curse_write(a, target, store);
+    WRITE_INT(store, b->id);
 }
 
 typedef struct bresolve {
-  int id;
-  curse *self;
+    int id;
+    curse *self;
 } bresolve;
 
 static int resolve_buddy(variant data, void *addr);
 
 static int cw_read(attrib * a, void *target, storage * store)
 {
-  bresolve *br = calloc(sizeof(bresolve), 1);
-  curse *c = (curse *) a->data.v;
-  wallcurse *wc = (wallcurse *) c->data.v;
-  variant var;
+    bresolve *br = calloc(sizeof(bresolve), 1);
+    curse *c = (curse *)a->data.v;
+    wallcurse *wc = (wallcurse *)c->data.v;
+    variant var;
 
-  curse_read(a, store, target);
-  br->self = c;
-  READ_INT(store, &br->id);
+    curse_read(a, store, target);
+    br->self = c;
+    READ_INT(store, &br->id);
 
-  var.i = br->id;
-  ur_add(var, &wc->wall, resolve_borderid);
+    var.i = br->id;
+    ur_add(var, &wc->wall, resolve_borderid);
 
-  var.v = br;
-  ur_add(var, &wc->buddy, resolve_buddy);
-  return AT_READ_OK;
+    var.v = br;
+    ur_add(var, &wc->buddy, resolve_buddy);
+    return AT_READ_OK;
 }
 
 /* ------------------------------------------------------------- */
@@ -88,204 +88,206 @@ static int cw_read(attrib * a, void *target, storage * store)
 
 void wall_vigour(curse * c, float delta)
 {
-  wallcurse *wc = (wallcurse *) c->data.v;
-  assert(wc->buddy->vigour == c->vigour);
-  wc->buddy->vigour += delta;
-  if (wc->buddy->vigour <= 0) {
-    erase_border(wc->wall);
-    wc->wall = NULL;
-    ((wallcurse *) wc->buddy->data.v)->wall = NULL;
-  }
+    wallcurse *wc = (wallcurse *)c->data.v;
+    assert(wc->buddy->vigour == c->vigour);
+    wc->buddy->vigour += delta;
+    if (wc->buddy->vigour <= 0) {
+        erase_border(wc->wall);
+        wc->wall = NULL;
+        ((wallcurse *)wc->buddy->data.v)->wall = NULL;
+    }
 }
 
 const curse_type ct_firewall = {
-  "Feuerwand",
-  CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR | NO_MERGE),
-  NULL,                         /* curseinfo */
-  wall_vigour                   /* change_vigour */
+    "Feuerwand",
+    CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR | NO_MERGE),
+    NULL,                         /* curseinfo */
+    wall_vigour                   /* change_vigour */
 };
 
 attrib_type at_cursewall = {
-  "cursewall",
-  cw_init,
-  curse_done,
-  curse_age,
-  cw_write,
-  cw_read,
-  ATF_CURSE
+    "cursewall",
+    cw_init,
+    curse_done,
+    curse_age,
+    cw_write,
+    cw_read,
+    ATF_CURSE
 };
 
 static int resolve_buddy(variant data, void *addr)
 {
-  curse *result = NULL;
-  bresolve *br = (bresolve *) data.v;
-  connection *b;
+    curse *result = NULL;
+    bresolve *br = (bresolve *)data.v;
+    connection *b;
 
-  assert(br->id > 0);
-  b = find_border(br->id);
+    assert(br->id > 0);
+    b = find_border(br->id);
 
-  if (b && b->from && b->to) {
-    attrib *a = a_find(b->from->attribs, &at_cursewall);
-    while (a && a->data.v != br->self) {
-      curse *c = (curse *) a->data.v;
-      wallcurse *wc = (wallcurse *) c->data.v;
-      if (wc->wall->id == br->id)
-        break;
-      a = a->next;
+    if (b && b->from && b->to) {
+        attrib *a = a_find(b->from->attribs, &at_cursewall);
+        while (a && a->data.v != br->self) {
+            curse *c = (curse *)a->data.v;
+            wallcurse *wc = (wallcurse *)c->data.v;
+            if (wc->wall->id == br->id)
+                break;
+            a = a->next;
+        }
+        if (!a || a->type != &at_cursewall) {
+            a = a_find(b->to->attribs, &at_cursewall);
+            while (a && a->type == &at_cursewall && a->data.v != br->self) {
+                curse *c = (curse *)a->data.v;
+                wallcurse *wc = (wallcurse *)c->data.v;
+                if (wc->wall->id == br->id)
+                    break;
+                a = a->next;
+            }
+        }
+        if (a && a->type == &at_cursewall) {
+            curse *c = (curse *)a->data.v;
+            free(br);
+            result = c;
+        }
     }
-    if (!a || a->type != &at_cursewall) {
-      a = a_find(b->to->attribs, &at_cursewall);
-      while (a && a->type == &at_cursewall && a->data.v != br->self) {
-        curse *c = (curse *) a->data.v;
-        wallcurse *wc = (wallcurse *) c->data.v;
-        if (wc->wall->id == br->id)
-          break;
-        a = a->next;
-      }
+    else {
+        /* fail, object does not exist (but if you're still loading then
+          * you may want to try again later) */
+        *(curse **)addr = NULL;
+        return -1;
     }
-    if (a && a->type == &at_cursewall) {
-      curse *c = (curse *) a->data.v;
-      free(br);
-      result = c;
-    }
-  } else {
-    /* fail, object does not exist (but if you're still loading then 
-      * you may want to try again later) */
-    *(curse **) addr = NULL;
-    return -1;
-  }
-  *(curse **) addr = result;
-  return 0;
+    *(curse **)addr = result;
+    return 0;
 }
 
 static void wall_init(connection * b)
 {
-  wall_data *fd = (wall_data *) calloc(sizeof(wall_data), 1);
-  fd->countdown = -1;           /* infinite */
-  b->data.v = fd;
+    wall_data *fd = (wall_data *)calloc(sizeof(wall_data), 1);
+    fd->countdown = -1;           /* infinite */
+    b->data.v = fd;
 }
 
 static void wall_destroy(connection * b)
 {
-  free(b->data.v);
+    free(b->data.v);
 }
 
 static void wall_read(connection * b, storage * store)
 {
-  static wall_data dummy;
-  wall_data *fd = b->data.v ? (wall_data *) b->data.v : &dummy;
+    static wall_data dummy;
+    wall_data *fd = b->data.v ? (wall_data *)b->data.v : &dummy;
 
-  read_reference(&fd->mage, store, read_unit_reference, resolve_unit);
-  READ_INT(store, &fd->force);
-  if (global.data_version >= NOBORDERATTRIBS_VERSION) {
-    READ_INT(store, &fd->countdown);
-  }
-  fd->active = true;
+    read_reference(&fd->mage, store, read_unit_reference, resolve_unit);
+    READ_INT(store, &fd->force);
+    if (global.data_version >= NOBORDERATTRIBS_VERSION) {
+        READ_INT(store, &fd->countdown);
+    }
+    fd->active = true;
 }
 
 static void wall_write(const connection * b, storage * store)
 {
-  wall_data *fd = (wall_data *) b->data.v;
-  write_unit_reference(fd->mage, store);
-  WRITE_INT(store, fd->force);
-  WRITE_INT(store, fd->countdown);
+    wall_data *fd = (wall_data *)b->data.v;
+    write_unit_reference(fd->mage, store);
+    WRITE_INT(store, fd->force);
+    WRITE_INT(store, fd->countdown);
 }
 
 static int wall_age(connection * b)
 {
-  wall_data *fd = (wall_data *) b->data.v;
-  --fd->countdown;
-  return (fd->countdown > 0) ? AT_AGE_KEEP : AT_AGE_REMOVE;
+    wall_data *fd = (wall_data *)b->data.v;
+    --fd->countdown;
+    return (fd->countdown > 0) ? AT_AGE_KEEP : AT_AGE_REMOVE;
 }
 
 static region *wall_move(const connection * b, struct unit *u,
-  struct region *from, struct region *to, bool routing)
+struct region *from, struct region *to, bool routing)
 {
-  wall_data *fd = (wall_data *) b->data.v;
-  if (!routing && fd->active) {
-    int hp = dice(3, fd->force) * u->number;
-    hp = _min(u->hp, hp);
-    u->hp -= hp;
-    if (u->hp) {
-      ADDMSG(&u->faction->msgs, msg_message("firewall_damage",
-          "region unit", from, u));
-    } else
-      ADDMSG(&u->faction->msgs, msg_message("firewall_death", "region unit",
-          from, u));
-    if (u->number > u->hp) {
-      scale_number(u, u->hp);
-      u->hp = u->number;
+    wall_data *fd = (wall_data *)b->data.v;
+    if (!routing && fd->active) {
+        int hp = dice(3, fd->force) * u->number;
+        hp = _min(u->hp, hp);
+        u->hp -= hp;
+        if (u->hp) {
+            ADDMSG(&u->faction->msgs, msg_message("firewall_damage",
+                "region unit", from, u));
+        }
+        else
+            ADDMSG(&u->faction->msgs, msg_message("firewall_death", "region unit",
+            from, u));
+        if (u->number > u->hp) {
+            scale_number(u, u->hp);
+            u->hp = u->number;
+        }
     }
-  }
-  return to;
+    return to;
 }
 
 static const char *b_namefirewall(const connection * b, const region * r,
-  const faction * f, int gflags)
+    const faction * f, int gflags)
 {
-  const char *bname;
-  unused_arg(f);
-  unused_arg(r);
-  unused_arg(b);
-  if (gflags & GF_ARTICLE)
-    bname = "a_firewall";
-  else
-    bname = "firewall";
+    const char *bname;
+    unused_arg(f);
+    unused_arg(r);
+    unused_arg(b);
+    if (gflags & GF_ARTICLE)
+        bname = "a_firewall";
+    else
+        bname = "firewall";
 
-  if (gflags & GF_PURE)
-    return bname;
-  return LOC(f->locale, mkname("border", bname));
+    if (gflags & GF_PURE)
+        return bname;
+    return LOC(f->locale, mkname("border", bname));
 }
 
 border_type bt_firewall = {
-  "firewall", VAR_VOIDPTR,
-  b_transparent,                /* transparent */
-  wall_init,                    /* init */
-  wall_destroy,                 /* destroy */
-  wall_read,                    /* read */
-  wall_write,                   /* write */
-  b_blocknone,                  /* block */
-  b_namefirewall,               /* name */
-  b_rvisible,                   /* rvisible */
-  b_finvisible,                 /* fvisible */
-  b_uinvisible,                 /* uvisible */
-  NULL,
-  wall_move,
-  wall_age
+    "firewall", VAR_VOIDPTR,
+    b_transparent,                /* transparent */
+    wall_init,                    /* init */
+    wall_destroy,                 /* destroy */
+    wall_read,                    /* read */
+    wall_write,                   /* write */
+    b_blocknone,                  /* block */
+    b_namefirewall,               /* name */
+    b_rvisible,                   /* rvisible */
+    b_finvisible,                 /* fvisible */
+    b_uinvisible,                 /* uvisible */
+    NULL,
+    wall_move,
+    wall_age
 };
 
 void convert_firewall_timeouts(connection * b, attrib * a)
 {
-  while (a) {
-    if (b->type == &bt_firewall && a->type == &at_countdown) {
-      wall_data *fd = (wall_data *) b->data.v;
-      fd->countdown = a->data.i;
+    while (a) {
+        if (b->type == &bt_firewall && a->type == &at_countdown) {
+            wall_data *fd = (wall_data *)b->data.v;
+            fd->countdown = a->data.i;
+        }
     }
-  }
 }
 
 border_type bt_wisps = { /* only here for reading old data */
-  "wisps", VAR_VOIDPTR,
-  b_transparent,                /* transparent */
-  0,                   /* init */
-  wall_destroy,                 /* destroy */
-  wall_read,                    /* read */
-  0,                   /* write */
-  b_blocknone,                  /* block */
-  0,                   /* name */
-  b_rvisible,                   /* rvisible */
-  b_fvisible,                   /* fvisible */
-  b_uvisible,                   /* uvisible */
-  NULL,                         /* visible */
-  0
+    "wisps", VAR_VOIDPTR,
+    b_transparent,                /* transparent */
+    0,                   /* init */
+    wall_destroy,                 /* destroy */
+    wall_read,                    /* read */
+    0,                   /* write */
+    b_blocknone,                  /* block */
+    0,                   /* name */
+    b_rvisible,                   /* rvisible */
+    b_fvisible,                   /* fvisible */
+    b_uvisible,                   /* uvisible */
+    NULL,                         /* visible */
+    0
 };
 
 void register_borders(void)
 {
-  border_convert_cb = &convert_firewall_timeouts;
-  at_register(&at_cursewall);
+    border_convert_cb = &convert_firewall_timeouts;
+    at_register(&at_cursewall);
 
-  register_bordertype(&bt_firewall);
-  register_bordertype(&bt_wisps);
-  register_bordertype(&bt_chaosgate);
+    register_bordertype(&bt_firewall);
+    register_bordertype(&bt_wisps);
+    register_bordertype(&bt_chaosgate);
 }
diff --git a/src/spells/borders.h b/src/spells/borders.h
index faf80ffd9..31823df94 100644
--- a/src/spells/borders.h
+++ b/src/spells/borders.h
@@ -4,23 +4,23 @@
 extern "C" {
 #endif
 
-  extern void register_borders(void);
+    extern void register_borders(void);
 
-  /* f�r Feuerw�nde: in movement mu� das noch explizit getestet werden.
-   ** besser w�re eine blcok_type::move() routine, die den effekt
-   ** der Bewegung auf eine struct unit anwendet.
-   **/
-  extern struct border_type bt_chaosgate;
-  extern struct border_type bt_firewall;
+    /* f�r Feuerw�nde: in movement mu� das noch explizit getestet werden.
+     ** besser w�re eine blcok_type::move() routine, die den effekt
+     ** der Bewegung auf eine struct unit anwendet.
+     **/
+    extern struct border_type bt_chaosgate;
+    extern struct border_type bt_firewall;
 
-  typedef struct wall_data {
-    struct unit *mage;
-    int force;
-    bool active;
-    int countdown;
-  } wall_data;
-  
-  extern const struct curse_type ct_firewall;
+    typedef struct wall_data {
+        struct unit *mage;
+        int force;
+        bool active;
+        int countdown;
+    } wall_data;
+
+    extern const struct curse_type ct_firewall;
 
 #ifdef __cplusplus
 }
diff --git a/src/spells/buildingcurse.c b/src/spells/buildingcurse.c
index 142ca66fa..0f7a17f5b 100644
--- a/src/spells/buildingcurse.c
+++ b/src/spells/buildingcurse.c
@@ -1,6 +1,6 @@
-/* vi: set ts=2:
+/*
  *
- * Eressea PB(E)M host Copyright (C) 1998-2003
+ * Eressea PB(E)M host Copyright (C) 1998-2015
  *      Christian Schlittchen (corwin@amber.kn-bremen.de)
  *      Katja Zedel (katze@felidae.kn-bremen.de)
  *      Henning Peters (faroul@beyond.kn-bremen.de)
@@ -34,65 +34,66 @@
 #include <assert.h>
 
 static message *cinfo_building(const void *obj, objtype_t typ, const curse * c,
-  int self)
+    int self)
 {
-  unused_arg(typ);
-  assert(typ == TYP_BUILDING);
+    unused_arg(typ);
+    assert(typ == TYP_BUILDING);
 
-  if (self != 0) {              /* owner or inside */
-    return msg_message(mkname("curseinfo", c->type->cname), "id", c->no);
-  }
-  return msg_message(mkname("curseinfo", "buildingunknown"), "id", c->no);
+    if (self != 0) {              /* owner or inside */
+        return msg_message(mkname("curseinfo", c->type->cname), "id", c->no);
+    }
+    return msg_message(mkname("curseinfo", "buildingunknown"), "id", c->no);
 }
 
 /* CurseInfo mit Spezialabfragen */
 
 /* C_MAGICWALLS*/
 static message *cinfo_magicrunes(const void *obj, objtype_t typ, const curse * c,
-  int self)
+    int self)
 {
-  message *msg = NULL;
-  if (typ == TYP_BUILDING) {
-    building *b;
-    b = (building *) obj;
-    if (self != 0) {
-      msg =
-        msg_message("curseinfo::magicrunes_building", "building id", b, c->no);
+    message *msg = NULL;
+    if (typ == TYP_BUILDING) {
+        building *b;
+        b = (building *)obj;
+        if (self != 0) {
+            msg =
+                msg_message("curseinfo::magicrunes_building", "building id", b, c->no);
+        }
     }
-  } else if (typ == TYP_SHIP) {
-    ship *sh;
-    sh = (ship *) obj;
-    if (self != 0) {
-      msg = msg_message("curseinfo::magicrunes_ship", "ship id", sh, c->no);
+    else if (typ == TYP_SHIP) {
+        ship *sh;
+        sh = (ship *)obj;
+        if (self != 0) {
+            msg = msg_message("curseinfo::magicrunes_ship", "ship id", sh, c->no);
+        }
     }
-  }
 
-  return msg;
+    return msg;
 }
 
 static struct curse_type ct_magicrunes = { "magicrunes",
-  CURSETYP_NORM, 0, M_SUMEFFECT, cinfo_magicrunes
+CURSETYP_NORM, 0, M_SUMEFFECT, cinfo_magicrunes
 };
 
 /* Heimstein-Zauber */
 static struct curse_type ct_magicwalls = { "magicwalls",
-  CURSETYP_NORM, 0, NO_MERGE, cinfo_building
+CURSETYP_NORM, 0, NO_MERGE, cinfo_building
 };
 
 /* Feste Mauer - Pr�kampfzauber, wirkt nur 1 Runde */
 static struct curse_type ct_strongwall = { "strongwall",
-  CURSETYP_NORM, 0, NO_MERGE, NULL
+CURSETYP_NORM, 0, NO_MERGE, NULL
 };
 
 /* Ewige Mauern-Zauber */
 static struct curse_type ct_nocostbuilding = { "nocostbuilding",
-  CURSETYP_NORM, CURSE_NOAGE | CURSE_ONLYONE, NO_MERGE, cinfo_building
+CURSETYP_NORM, CURSE_NOAGE | CURSE_ONLYONE, NO_MERGE, cinfo_building
 };
 
 void register_buildingcurse(void)
 {
-  ct_register(&ct_magicwalls);
-  ct_register(&ct_strongwall);
-  ct_register(&ct_magicrunes);
-  ct_register(&ct_nocostbuilding);
+    ct_register(&ct_magicwalls);
+    ct_register(&ct_strongwall);
+    ct_register(&ct_magicrunes);
+    ct_register(&ct_nocostbuilding);
 }
diff --git a/src/spells/buildingcurse.h b/src/spells/buildingcurse.h
index a3b05dedc..d6366c920 100644
--- a/src/spells/buildingcurse.h
+++ b/src/spells/buildingcurse.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  *
  * Eressea PB(E)M host Copyright (C) 1998-2003
  *      Christian Schlittchen (corwin@amber.kn-bremen.de)
@@ -17,10 +17,10 @@
 extern "C" {
 #endif
 
-  struct locale;
-  struct curse;
+    struct locale;
+    struct curse;
 
-  extern void register_buildingcurse(void);
+    extern void register_buildingcurse(void);
 
 #ifdef __cplusplus
 }
diff --git a/src/spells/combatspells.c b/src/spells/combatspells.c
index bd4bc2313..21410465d 100644
--- a/src/spells/combatspells.c
+++ b/src/spells/combatspells.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/*
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -8,7 +8,7 @@
 
  This program may not be used, modified or distributed
  without prior permission by the authors of Eressea.
-*/
+ */
 #include <platform.h>
 #include <kernel/config.h>
 #include "combatspells.h"
@@ -54,218 +54,218 @@
 
 static const char *spell_damage(int sp)
 {
-  switch (sp) {
+    switch (sp) {
     case 0:
-      /* meist t�dlich 20-65 HP */
-      return "5d10+15";
+        /* meist t�dlich 20-65 HP */
+        return "5d10+15";
     case 1:
-      /* sehr variabel 4-48 HP */
-      return "4d12";
+        /* sehr variabel 4-48 HP */
+        return "4d12";
     case 2:
-      /* leicht verwundet 4-18 HP */
-      return "2d8+2";
+        /* leicht verwundet 4-18 HP */
+        return "2d8+2";
     case 3:
-      /* fast immer t�dlich 30-50 HP */
-      return "5d5+25";
+        /* fast immer t�dlich 30-50 HP */
+        return "5d5+25";
     case 4:
-      /* verwundet 11-26 HP */
-      return "3d6+8";
+        /* verwundet 11-26 HP */
+        return "3d6+8";
     case 5:
-      /* leichter Schaden */
-      return "2d4";
+        /* leichter Schaden */
+        return "2d4";
     default:
-      /* schwer verwundet 14-34 HP */
-      return "4d6+10";
-  }
+        /* schwer verwundet 14-34 HP */
+        return "4d6+10";
+    }
 }
 
 static double get_force(double power, int formel)
 {
-  switch (formel) {
+    switch (formel) {
     case 0:
-      /* (4,8,12,16,20,24,28,32,36,40,44,..) */
-      return (power * 4);
+        /* (4,8,12,16,20,24,28,32,36,40,44,..) */
+        return (power * 4);
     case 1:
-      /* (15,30,45,60,75,90,105,120,135,150,165,..) */
-      return (power * 15);
+        /* (15,30,45,60,75,90,105,120,135,150,165,..) */
+        return (power * 15);
     case 2:
-      /* (40,80,120,160,200,240,280,320,360,400,440,..) */
-      return (power * 40);
+        /* (40,80,120,160,200,240,280,320,360,400,440,..) */
+        return (power * 40);
     case 3:
-      /* (2,8,18,32,50,72,98,128,162,200,242,..) */
-      return (power * power * 2);
+        /* (2,8,18,32,50,72,98,128,162,200,242,..) */
+        return (power * power * 2);
     case 4:
-      /* (4,16,36,64,100,144,196,256,324,400,484,..) */
-      return (power * power * 4);
+        /* (4,16,36,64,100,144,196,256,324,400,484,..) */
+        return (power * power * 4);
     case 5:
-      /* (10,40,90,160,250,360,490,640,810,1000,1210,1440,..) */
-      return (power * power * 10);
+        /* (10,40,90,160,250,360,490,640,810,1000,1210,1440,..) */
+        return (power * power * 10);
     case 6:
-      /* (6,24,54,96,150,216,294,384,486,600,726,864) */
-      return (power * power * 6);
+        /* (6,24,54,96,150,216,294,384,486,600,726,864) */
+        return (power * power * 6);
     default:
-      return power;
-  }
+        return power;
+    }
 }
 
 /* Generischer Kampfzauber */
 int sp_kampfzauber(struct castorder * co)
 {
-  fighter * fi = co->magician.fig;
-  int level = co->level;
-  double power = co->force;
-  const spell * sp = co->sp;
-  battle *b = fi->side->battle;
-  troop at, dt;
-  message *m;
-  /* Immer aus der ersten Reihe nehmen */
-  int force, enemies;
-  int killed = 0;
-  const char *damage;
+    fighter * fi = co->magician.fig;
+    int level = co->level;
+    double power = co->force;
+    const spell * sp = co->sp;
+    battle *b = fi->side->battle;
+    troop at, dt;
+    message *m;
+    /* Immer aus der ersten Reihe nehmen */
+    int force, enemies;
+    int killed = 0;
+    const char *damage;
 
-  if (power <= 0)
-    return 0;
-  at.fighter = fi;
-  at.index = 0;
+    if (power <= 0)
+        return 0;
+    at.fighter = fi;
+    at.index = 0;
 
-  switch (sp->id) {
-      /* lovar halbiert im Schnitt! */
+    switch (sp->id) {
+        /* lovar halbiert im Schnitt! */
     case SPL_FIREBALL:
-      damage = spell_damage(0);
-      force = lovar(get_force(power, 0));
-      break;
+        damage = spell_damage(0);
+        force = lovar(get_force(power, 0));
+        break;
     case SPL_HAGEL:
-      damage = spell_damage(2);
-      force = lovar(get_force(power, 4));
-      break;
+        damage = spell_damage(2);
+        force = lovar(get_force(power, 4));
+        break;
     case SPL_METEORRAIN:
-      damage = spell_damage(1);
-      force = lovar(get_force(power, 1));
-      break;
+        damage = spell_damage(1);
+        force = lovar(get_force(power, 1));
+        break;
     default:
-      damage = spell_damage(10);
-      force = lovar(get_force(power, 10));
-  }
+        damage = spell_damage(10);
+        force = lovar(get_force(power, 10));
+    }
 
-  enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE);
-  if (enemies == 0) {
-    message *m =
-      msg_message("battle::out_of_range", "mage spell", fi->unit, sp);
+    enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE);
+    if (enemies == 0) {
+        message *m =
+            msg_message("battle::out_of_range", "mage spell", fi->unit, sp);
+        message_all(b, m);
+        msg_release(m);
+        return 0;
+    }
+
+    while (force > 0 && killed < enemies) {
+        dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE);
+        assert(dt.fighter);
+        --force;
+        killed += terminate(dt, at, AT_COMBATSPELL, damage, false);
+    }
+
+    m = msg_message("battle::combatspell", "mage spell dead",
+        fi->unit, sp, killed);
     message_all(b, m);
     msg_release(m);
-    return 0;
-  }
 
-  while (force > 0 && killed < enemies) {
-    dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE);
-    assert(dt.fighter);
-    --force;
-    killed += terminate(dt, at, AT_COMBATSPELL, damage, false);
-  }
-
-  m = msg_message("battle::combatspell", "mage spell dead",
-    fi->unit, sp, killed);
-  message_all(b, m);
-  msg_release(m);
-
-  return level;
+    return level;
 }
 
 /* Versteinern */
 int sp_petrify(struct castorder * co)
 {
-  fighter * fi = co->magician.fig;
-  int level = co->level;
-  double power = co->force;
-  const spell * sp = co->sp;
-  battle *b = fi->side->battle;
-  unit *mage = fi->unit;
-  /* Wirkt auf erste und zweite Reihe */
-  int force, enemies;
-  int stoned = 0;
-  message *m;
+    fighter * fi = co->magician.fig;
+    int level = co->level;
+    double power = co->force;
+    const spell * sp = co->sp;
+    battle *b = fi->side->battle;
+    unit *mage = fi->unit;
+    /* Wirkt auf erste und zweite Reihe */
+    int force, enemies;
+    int stoned = 0;
+    message *m;
 
-  force = lovar(get_force(power, 0));
+    force = lovar(get_force(power, 0));
 
-  enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
-  if (!enemies) {
-    message *m =
-      msg_message("battle::out_of_range", "mage spell", fi->unit, sp);
+    enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
+    if (!enemies) {
+        message *m =
+            msg_message("battle::out_of_range", "mage spell", fi->unit, sp);
+        message_all(b, m);
+        msg_release(m);
+        return 0;
+    }
+
+    while (force && stoned < enemies) {
+        troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
+        unit *du = dt.fighter->unit;
+        if (!is_magic_resistant(mage, du, 0)) {
+            /* person ans ende hinter die lebenden schieben */
+            remove_troop(dt);
+            ++stoned;
+        }
+        --force;
+    }
+
+    m =
+        msg_message("cast_petrify_effect", "mage spell amount", fi->unit, sp,
+        stoned);
     message_all(b, m);
     msg_release(m);
-    return 0;
-  }
-
-  while (force && stoned < enemies) {
-    troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
-    unit *du = dt.fighter->unit;
-    if (!is_magic_resistant(mage, du, 0)) {
-      /* person ans ende hinter die lebenden schieben */
-      remove_troop(dt);
-      ++stoned;
-    }
-    --force;
-  }
-
-  m =
-    msg_message("cast_petrify_effect", "mage spell amount", fi->unit, sp,
-    stoned);
-  message_all(b, m);
-  msg_release(m);
-  return level;
+    return level;
 }
 
 /* Benommenheit: eine Runde kein Angriff */
 int sp_stun(struct castorder * co)
 {
-  fighter * fi = co->magician.fig;
-  int level = co->level;
-  double power = co->force;
-  const spell * sp = co->sp;
-  battle *b = fi->side->battle;
-  unit *mage = fi->unit;
-  message *m;
-  /* Aus beiden Reihen nehmen */
-  int force = 0, enemies;
-  int stunned;
+    fighter * fi = co->magician.fig;
+    int level = co->level;
+    double power = co->force;
+    const spell * sp = co->sp;
+    battle *b = fi->side->battle;
+    unit *mage = fi->unit;
+    message *m;
+    /* Aus beiden Reihen nehmen */
+    int force = 0, enemies;
+    int stunned;
 
-  if (power <= 0)
-    return 0;
+    if (power <= 0)
+        return 0;
 
-  switch (sp->id) {
+    switch (sp->id) {
     case SPL_SHOCKWAVE:
-      force = lovar(get_force(power, 1));
-      break;
+        force = lovar(get_force(power, 1));
+        break;
     default:
-      assert(0);
-  }
+        assert(0);
+    }
 
-  enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
-  if (!enemies) {
-    message *m =
-      msg_message("battle::out_of_range", "mage spell", fi->unit, sp);
+    enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
+    if (!enemies) {
+        message *m =
+            msg_message("battle::out_of_range", "mage spell", fi->unit, sp);
+        message_all(b, m);
+        msg_release(m);
+        return 0;
+    }
+
+    stunned = 0;
+    while (force && stunned < enemies) {
+        troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
+        fighter *df = dt.fighter;
+        unit *du = df->unit;
+
+        --force;
+        if (!is_magic_resistant(mage, du, 0)) {
+            df->person[dt.index].flags |= FL_STUNNED;
+            ++stunned;
+        }
+    }
+
+    m = msg_message("cast_stun_effect", "mage spell amount", fi->unit, sp, stunned);
     message_all(b, m);
     msg_release(m);
-    return 0;
-  }
-
-  stunned = 0;
-  while (force && stunned < enemies) {
-    troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
-    fighter *df = dt.fighter;
-    unit *du = df->unit;
-
-    --force;
-    if (!is_magic_resistant(mage, du, 0)) {
-      df->person[dt.index].flags |= FL_STUNNED;
-      ++stunned;
-    }
-  }
-
-  m = msg_message("cast_stun_effect", "mage spell amount", fi->unit, sp, stunned);
-  message_all(b, m);
-  msg_release(m);
-  return level;
+    return level;
 }
 
 /** randomly shuffle an array
@@ -273,286 +273,288 @@ int sp_stun(struct castorder * co)
  */
 static void scramble_fighters(quicklist * ql)
 {
-  int qi, qlen = ql_length(ql);
+    int qi, qlen = ql_length(ql);
 
-  for (qi = 0; qi != qlen; ++qi) {
-    int qj = qi + (rng_int() % (qlen - qi));
-    void *a = ql_get(ql, qi);
-    void *b = ql_replace(ql, qj, a);
-    ql_replace(ql, qi, b);
-  }
+    for (qi = 0; qi != qlen; ++qi) {
+        int qj = qi + (rng_int() % (qlen - qi));
+        void *a = ql_get(ql, qi);
+        void *b = ql_replace(ql, qj, a);
+        ql_replace(ql, qi, b);
+    }
 }
 
 /* Rosthauch */
 int sp_combatrosthauch(struct castorder * co)
 {
-  fighter * fi = co->magician.fig;
-  int level = co->level;
-  double power = co->force;
-  battle *b = fi->side->battle;
-  quicklist *ql, *fgs;
-  int force = lovar(power * 15);
-  int qi, k = 0;
+    fighter * fi = co->magician.fig;
+    int level = co->level;
+    double power = co->force;
+    battle *b = fi->side->battle;
+    quicklist *ql, *fgs;
+    int force = lovar(power * 15);
+    int qi, k = 0;
 
-  if (!count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW - 1,
-      SELECT_ADVANCE | SELECT_FIND)) {
-    message *msg = msg_message("rust_effect_0", "mage", fi->unit);
-    message_all(b, msg);
-    msg_release(msg);
-    return 0;
-  }
-
-  fgs = fighters(b, fi->side, FIGHT_ROW, BEHIND_ROW - 1, FS_ENEMY);
-  scramble_fighters(fgs);
-
-  for (qi = 0, ql = fgs; ql; ql_advance(&ql, &qi, 1)) {
-    fighter *df = (fighter *) ql_get(ql, qi);
-
-    if (df->alive == 0)
-      continue;
-    if (force <= 0)
-      break;
-
-    /* da n _min(force, x), sollte force maximal auf 0 sinken */
-    assert(force >= 0);
-
-    if (df->weapons) {
-      int w;
-      for (w = 0; df->weapons[w].type != NULL; ++w) {
-        weapon *wp = df->weapons;
-        int n = _min(force, wp->used);
-        if (n) {
-          requirement *mat = wp->type->itype->construction->materials;
-          bool iron = false;
-          while (mat && mat->number > 0) {
-            if (mat->rtype == get_resourcetype(R_IRON)) {
-              iron = true;
-              break;
-            }
-            mat++;
-          }
-          if (iron) {
-            int p;
-            force -= n;
-            wp->used -= n;
-            k += n;
-            i_change(&df->unit->items, wp->type->itype, -n);
-            for (p = 0; n && p != df->unit->number; ++p) {
-              if (df->person[p].missile == wp) {
-                df->person[p].missile = NULL;
-                --n;
-              }
-            }
-            for (p = 0; n && p != df->unit->number; ++p) {
-              if (df->person[p].melee == wp) {
-                df->person[p].melee = NULL;
-                --n;
-              }
-            }
-          }
-        }
-      }
+    if (!count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW - 1,
+        SELECT_ADVANCE | SELECT_FIND)) {
+        message *msg = msg_message("rust_effect_0", "mage", fi->unit);
+        message_all(b, msg);
+        msg_release(msg);
+        return 0;
     }
-  }
-  ql_free(fgs);
 
-  if (k == 0) {
-    /* keine Waffen mehr da, die zerst�rt werden k�nnten */
-    message *msg = msg_message("rust_effect_1", "mage", fi->unit);
-    message_all(b, msg);
-    msg_release(msg);
-    fi->magic = 0;              /* k�mpft nichtmagisch weiter */
-    level = 0;
-  } else {
-    message *msg = msg_message("rust_effect_2", "mage", fi->unit);
-    message_all(b, msg);
-    msg_release(msg);
-  }
-  return level;
+    fgs = fighters(b, fi->side, FIGHT_ROW, BEHIND_ROW - 1, FS_ENEMY);
+    scramble_fighters(fgs);
+
+    for (qi = 0, ql = fgs; ql; ql_advance(&ql, &qi, 1)) {
+        fighter *df = (fighter *)ql_get(ql, qi);
+
+        if (df->alive == 0)
+            continue;
+        if (force <= 0)
+            break;
+
+        /* da n _min(force, x), sollte force maximal auf 0 sinken */
+        assert(force >= 0);
+
+        if (df->weapons) {
+            int w;
+            for (w = 0; df->weapons[w].type != NULL; ++w) {
+                weapon *wp = df->weapons;
+                int n = _min(force, wp->used);
+                if (n) {
+                    requirement *mat = wp->type->itype->construction->materials;
+                    bool iron = false;
+                    while (mat && mat->number > 0) {
+                        if (mat->rtype == get_resourcetype(R_IRON)) {
+                            iron = true;
+                            break;
+                        }
+                        mat++;
+                    }
+                    if (iron) {
+                        int p;
+                        force -= n;
+                        wp->used -= n;
+                        k += n;
+                        i_change(&df->unit->items, wp->type->itype, -n);
+                        for (p = 0; n && p != df->unit->number; ++p) {
+                            if (df->person[p].missile == wp) {
+                                df->person[p].missile = NULL;
+                                --n;
+                            }
+                        }
+                        for (p = 0; n && p != df->unit->number; ++p) {
+                            if (df->person[p].melee == wp) {
+                                df->person[p].melee = NULL;
+                                --n;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+    ql_free(fgs);
+
+    if (k == 0) {
+        /* keine Waffen mehr da, die zerst�rt werden k�nnten */
+        message *msg = msg_message("rust_effect_1", "mage", fi->unit);
+        message_all(b, msg);
+        msg_release(msg);
+        fi->magic = 0;              /* k�mpft nichtmagisch weiter */
+        level = 0;
+    }
+    else {
+        message *msg = msg_message("rust_effect_2", "mage", fi->unit);
+        message_all(b, msg);
+        msg_release(msg);
+    }
+    return level;
 }
 
 int sp_sleep(struct castorder * co)
 {
-  fighter * fi = co->magician.fig;
-  int level = co->level;
-  const spell * sp = co->sp;
-  battle *b = fi->side->battle;
-  unit *mage = fi->unit;
-  unit *du;
-  troop dt;
-  int force, enemies;
-  int k = 0;
-  message *m;
-  /* Immer aus der ersten Reihe nehmen */
+    fighter * fi = co->magician.fig;
+    int level = co->level;
+    const spell * sp = co->sp;
+    battle *b = fi->side->battle;
+    unit *mage = fi->unit;
+    unit *du;
+    troop dt;
+    int force, enemies;
+    int k = 0;
+    message *m;
+    /* Immer aus der ersten Reihe nehmen */
 
-  force = lovar(co->force * 25);
-  enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
+    force = lovar(co->force * 25);
+    enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
 
-  if (!enemies) {
-    m = msg_message("battle::out_of_range", "mage spell", fi->unit, sp);
+    if (!enemies) {
+        m = msg_message("battle::out_of_range", "mage spell", fi->unit, sp);
+        message_all(b, m);
+        msg_release(m);
+        return 0;
+    }
+    while (force && enemies) {
+        dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
+        assert(dt.fighter);
+        du = dt.fighter->unit;
+        if (!is_magic_resistant(mage, du, 0)) {
+            dt.fighter->person[dt.index].flags |= FL_SLEEPING;
+            ++k;
+            --enemies;
+        }
+        --force;
+    }
+
+    m = msg_message("cast_sleep_effect", "mage spell amount", fi->unit, sp, k);
     message_all(b, m);
     msg_release(m);
-    return 0;
-  }
-  while (force && enemies) {
-    dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
-    assert(dt.fighter);
-    du = dt.fighter->unit;
-    if (!is_magic_resistant(mage, du, 0)) {
-      dt.fighter->person[dt.index].flags |= FL_SLEEPING;
-      ++k;
-      --enemies;
-    }
-    --force;
-  }
-
-  m = msg_message("cast_sleep_effect", "mage spell amount", fi->unit, sp, k);
-  message_all(b, m);
-  msg_release(m);
-  return level;
+    return level;
 }
 
 int sp_speed(struct castorder * co)
 {
-  fighter * fi = co->magician.fig;
-  double power = co->force;
-  const spell * sp = co->sp;
-  battle *b = fi->side->battle;
-  int force;
-  int allies;
-  int targets = 0;
-  message *m;
+    fighter * fi = co->magician.fig;
+    double power = co->force;
+    const spell * sp = co->sp;
+    battle *b = fi->side->battle;
+    int force;
+    int allies;
+    int targets = 0;
+    message *m;
 
-  force = lovar(power * power * 5);
+    force = lovar(power * power * 5);
 
-  allies =
-    count_allies(fi->side, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE, ALLY_ANY);
-  /* maximal 2*allies Versuche ein Opfer zu finden, ansonsten best�nde
-   * die Gefahr eine Endlosschleife*/
-  allies *= 2;
+    allies =
+        count_allies(fi->side, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE, ALLY_ANY);
+    /* maximal 2*allies Versuche ein Opfer zu finden, ansonsten best�nde
+     * die Gefahr eine Endlosschleife*/
+    allies *= 2;
 
-  while (force && allies) {
-    troop dt = select_ally(fi, FIGHT_ROW, BEHIND_ROW, ALLY_ANY);
-    fighter *df = dt.fighter;
-    --allies;
+    while (force && allies) {
+        troop dt = select_ally(fi, FIGHT_ROW, BEHIND_ROW, ALLY_ANY);
+        fighter *df = dt.fighter;
+        --allies;
 
-    if (df) {
-      if (df->person[dt.index].speed == 1) {
-        df->person[dt.index].speed++;
-        targets++;
-        --force;
-      }
+        if (df) {
+            if (df->person[dt.index].speed == 1) {
+                df->person[dt.index].speed++;
+                targets++;
+                --force;
+            }
+        }
     }
-  }
 
-  m =
-    msg_message("cast_speed_effect", "mage spell amount", fi->unit, sp,
-    targets);
-  message_all(b, m);
-  msg_release(m);
-  return 1;
+    m =
+        msg_message("cast_speed_effect", "mage spell amount", fi->unit, sp,
+        targets);
+    message_all(b, m);
+    msg_release(m);
+    return 1;
 }
 
 static skill_t random_skill(unit * u, bool weighted)
 {
-  int n = 0;
-  skill *sv;
+    int n = 0;
+    skill *sv;
 
-  for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
-    if (sv->level > 0) {
-      if (weighted)
-        n += sv->level;
-      else
-        ++n;
+    for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
+        if (sv->level > 0) {
+            if (weighted)
+                n += sv->level;
+            else
+                ++n;
+        }
     }
-  }
 
-  if (n == 0)
+    if (n == 0)
+        return NOSKILL;
+
+    n = rng_int() % n;
+
+    for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
+        if (sv->level > 0) {
+            if (weighted) {
+                if (n < (int)sv->level)
+                    return sv->id;
+                n -= sv->level;
+            }
+            else {
+                if (n == 0)
+                    return sv->id;
+                --n;
+            }
+        }
+    }
+
+    assert(0 == 1);               /* Hier sollte er niemals ankommen. */
     return NOSKILL;
-
-  n = rng_int() % n;
-
-  for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
-    if (sv->level > 0) {
-      if (weighted) {
-        if (n < (int)sv->level)
-          return sv->id;
-        n -= sv->level;
-      } else {
-        if (n == 0)
-          return sv->id;
-        --n;
-      }
-    }
-  }
-
-  assert(0 == 1);               /* Hier sollte er niemals ankommen. */
-  return NOSKILL;
 }
 
 /** The mind blast spell for regular folks.
-* This spell temporarily reduces the skill of the victims 
+* This spell temporarily reduces the skill of the victims
 */
 int sp_mindblast_temp(struct castorder * co)
 {
-  fighter * fi = co->magician.fig;
-  int level = co->level;
-  double power = co->force;
-  const spell * sp = co->sp;
-  battle *b = fi->side->battle;
-  unit *mage = fi->unit;
-  int k = 0, reset = 0, maxloss = (level + 2) / 3;
-  message *m;
-  int force = lovar(power * 25);
-  int enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
+    fighter * fi = co->magician.fig;
+    int level = co->level;
+    double power = co->force;
+    const spell * sp = co->sp;
+    battle *b = fi->side->battle;
+    unit *mage = fi->unit;
+    int k = 0, reset = 0, maxloss = (level + 2) / 3;
+    message *m;
+    int force = lovar(power * 25);
+    int enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
 
-  if (!enemies) {
-    m = msg_message("battle::out_of_range", "mage spell", fi->unit, sp);
+    if (!enemies) {
+        m = msg_message("battle::out_of_range", "mage spell", fi->unit, sp);
+        message_all(b, m);
+        msg_release(m);
+        return 0;
+    }
+
+    while (force > 0 && enemies > 0) {
+        unit *du;
+        troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
+
+        assert(dt.fighter);
+        du = dt.fighter->unit;
+        if (fval(du, UFL_MARK)) {
+            /* not this one again */
+            continue;
+        }
+
+        if (humanoidrace(u_race(du)) && force >= du->number) {
+            if (!is_magic_resistant(mage, du, 0)) {
+                skill_t sk = random_skill(du, true);
+                if (sk != NOSKILL) {
+                    int n = 1 + rng_int() % maxloss;
+                    attrib *a = make_skillmod(sk, SMF_ALWAYS, NULL, 0.0, n);
+                    /* neat: you can add a whole lot of these to a unit, they stack */
+                    a_add(&du->attribs, a);
+                }
+                k += du->number;
+            }
+            force -= du->number;
+        }
+        fset(du, UFL_MARK);
+        reset = 1;
+        enemies -= du->number;
+    }
+
+    if (reset) {
+        unit *u;
+        for (u = b->region->units; u; u = u->next) {
+            freset(u, UFL_MARK);
+        }
+    }
+
+    m = msg_message("sp_mindblast_temp_effect", "mage spell amount", mage, sp, k);
     message_all(b, m);
     msg_release(m);
-    return 0;
-  }
-
-  while (force > 0 && enemies > 0) {
-    unit *du;
-    troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
-
-    assert(dt.fighter);
-    du = dt.fighter->unit;
-    if (fval(du, UFL_MARK)) {
-      /* not this one again */
-      continue;
-    }
-
-    if (humanoidrace(u_race(du)) && force >= du->number) {
-      if (!is_magic_resistant(mage, du, 0)) {
-        skill_t sk = random_skill(du, true);
-        if (sk != NOSKILL) {
-          int n = 1 + rng_int() % maxloss;
-          attrib *a = make_skillmod(sk, SMF_ALWAYS, NULL, 0.0, n);
-          /* neat: you can add a whole lot of these to a unit, they stack */
-          a_add(&du->attribs, a);
-        }
-        k += du->number;
-      }
-      force -= du->number;
-    }
-    fset(du, UFL_MARK);
-    reset = 1;
-    enemies -= du->number;
-  }
-
-  if (reset) {
-    unit *u;
-    for (u = b->region->units; u; u = u->next) {
-      freset(u, UFL_MARK);
-    }
-  }
-
-  m = msg_message("sp_mindblast_temp_effect", "mage spell amount", mage, sp, k);
-  message_all(b, m);
-  msg_release(m);
-  return level;
+    return level;
 }
 
 /** A mind blast spell for monsters.
@@ -561,224 +563,227 @@ int sp_mindblast_temp(struct castorder * co)
  */
 int sp_mindblast(struct castorder * co)
 {
-  fighter * fi = co->magician.fig;
-  int level = co->level;
-  double power = co->force;
-  const spell * sp = co->sp;
-  battle *b = fi->side->battle;
-  unit *mage = fi->unit;
-  int killed = 0, k = 0, reset = 0;
-  message *m;
-  int force = lovar(power * 25);
-  int enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
+    fighter * fi = co->magician.fig;
+    int level = co->level;
+    double power = co->force;
+    const spell * sp = co->sp;
+    battle *b = fi->side->battle;
+    unit *mage = fi->unit;
+    int killed = 0, k = 0, reset = 0;
+    message *m;
+    int force = lovar(power * 25);
+    int enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
 
-  if (!enemies) {
-    m = msg_message("battle::out_of_range", "mage spell", fi->unit, sp);
+    if (!enemies) {
+        m = msg_message("battle::out_of_range", "mage spell", fi->unit, sp);
+        message_all(b, m);
+        msg_release(m);
+        return 0;
+    }
+
+    while (enemies > 0 && force > 0) {
+        unit *du;
+        troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
+
+        assert(dt.fighter);
+        du = dt.fighter->unit;
+        if (fval(du, UFL_MARK)) {
+            /* not this one again */
+            continue;
+        }
+
+        if (humanoidrace(u_race(du)) && force >= du->number) {
+            if (!is_magic_resistant(mage, du, 0)) {
+                skill_t sk = random_skill(du, false);
+                if (sk != NOSKILL) {
+                    skill *sv = unit_skill(du, sk);
+                    int n = 1 + rng_int() % 3;
+
+                    reduce_skill(du, sv, n);
+                    k += du->number;
+                }
+                else {
+                    /* unit has no skill. kill it. */
+                    kill_troop(dt);
+                    ++killed;
+                }
+            }
+            force -= du->number;
+        }
+        else {
+            /* only works against humanoids, don't try others. but do remove them
+             * from 'force' once or we may never terminate. */
+            fset(du, UFL_MARK);
+            reset = 1;
+        }
+        enemies -= du->number;
+    }
+
+    if (reset) {
+        unit *u;
+        for (u = b->region->units; u; u = u->next) {
+            freset(u, UFL_MARK);
+        }
+    }
+
+    m =
+        msg_message("sp_mindblast_effect", "mage spell amount dead", mage, sp, k,
+        killed);
     message_all(b, m);
     msg_release(m);
-    return 0;
-  }
-
-  while (enemies > 0 && force > 0) {
-    unit *du;
-    troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
-
-    assert(dt.fighter);
-    du = dt.fighter->unit;
-    if (fval(du, UFL_MARK)) {
-      /* not this one again */
-      continue;
-    }
-
-    if (humanoidrace(u_race(du)) && force >= du->number) {
-      if (!is_magic_resistant(mage, du, 0)) {
-        skill_t sk = random_skill(du, false);
-        if (sk != NOSKILL) {
-          skill *sv = unit_skill(du, sk);
-          int n = 1 + rng_int() % 3;
-
-          reduce_skill(du, sv, n);
-          k += du->number;
-        } else {
-          /* unit has no skill. kill it. */
-          kill_troop(dt);
-          ++killed;
-        }
-      }
-      force -= du->number;
-    } else {
-      /* only works against humanoids, don't try others. but do remove them
-       * from 'force' once or we may never terminate. */
-      fset(du, UFL_MARK);
-      reset = 1;
-    }
-    enemies -= du->number;
-  }
-
-  if (reset) {
-    unit *u;
-    for (u = b->region->units; u; u = u->next) {
-      freset(u, UFL_MARK);
-    }
-  }
-
-  m =
-    msg_message("sp_mindblast_effect", "mage spell amount dead", mage, sp, k,
-    killed);
-  message_all(b, m);
-  msg_release(m);
-  return level;
+    return level;
 }
 
 int sp_dragonodem(struct castorder * co)
 {
-  fighter * fi = co->magician.fig;
-  int level = co->level;
-  double power = co->force;
-  const spell * sp = co->sp;
-  battle *b = fi->side->battle;
-  troop dt;
-  troop at;
-  int force, enemies;
-  int killed = 0;
-  const char *damage;
+    fighter * fi = co->magician.fig;
+    int level = co->level;
+    double power = co->force;
+    const spell * sp = co->sp;
+    battle *b = fi->side->battle;
+    troop dt;
+    troop at;
+    int force, enemies;
+    int killed = 0;
+    const char *damage;
 
-  /* 11-26 HP */
-  damage = spell_damage(4);
-  /* Jungdrache 3->54, Drache 6->216, Wyrm 12->864 Treffer */
-  force = lovar(get_force(power, 6));
+    /* 11-26 HP */
+    damage = spell_damage(4);
+    /* Jungdrache 3->54, Drache 6->216, Wyrm 12->864 Treffer */
+    force = lovar(get_force(power, 6));
 
-  enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE);
+    enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE);
 
-  if (!enemies) {
-    struct message *m =
-      msg_message("battle::out_of_range", "mage spell", fi->unit, sp);
-    message_all(b, m);
-    msg_release(m);
-    return 0;
-  } else {
-    struct message *m;
-
-    at.fighter = fi;
-    at.index = 0;
-
-    while (force && killed < enemies) {
-      dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE);
-      assert(dt.fighter);
-      --force;
-      killed += terminate(dt, at, AT_COMBATSPELL, damage, false);
+    if (!enemies) {
+        struct message *m =
+            msg_message("battle::out_of_range", "mage spell", fi->unit, sp);
+        message_all(b, m);
+        msg_release(m);
+        return 0;
     }
+    else {
+        struct message *m;
 
-    m =
-      msg_message("battle::combatspell", "mage spell dead", fi->unit, sp,
-      killed);
-    message_all(b, m);
-    msg_release(m);
-  }
-  return level;
+        at.fighter = fi;
+        at.index = 0;
+
+        while (force && killed < enemies) {
+            dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE);
+            assert(dt.fighter);
+            --force;
+            killed += terminate(dt, at, AT_COMBATSPELL, damage, false);
+        }
+
+        m =
+            msg_message("battle::combatspell", "mage spell dead", fi->unit, sp,
+            killed);
+        message_all(b, m);
+        msg_release(m);
+    }
+    return level;
 }
 
 /* Feuersturm: Betrifft sehr viele Gegner (in der Regel alle),
  * macht nur vergleichsweise geringen Schaden */
 int sp_immolation(struct castorder * co)
 {
-  fighter * fi = co->magician.fig;
-  int level = co->level;
-  const spell * sp = co->sp;
-  battle *b = fi->side->battle;
-  troop at;
-  int force, qi, killed = 0;
-  const char *damage;
-  quicklist *fgs, *ql;
-  message *m;
+    fighter * fi = co->magician.fig;
+    int level = co->level;
+    const spell * sp = co->sp;
+    battle *b = fi->side->battle;
+    troop at;
+    int force, qi, killed = 0;
+    const char *damage;
+    quicklist *fgs, *ql;
+    message *m;
 
-  /* 2d4 HP */
-  damage = spell_damage(5);
-  /* Betrifft alle Gegner */
-  force = 99999;
+    /* 2d4 HP */
+    damage = spell_damage(5);
+    /* Betrifft alle Gegner */
+    force = 99999;
 
-  if (!count_enemies(b, fi, FIGHT_ROW, AVOID_ROW, SELECT_ADVANCE | SELECT_FIND)) {
-    message *m =
-      msg_message("battle::out_of_range", "mage spell", fi->unit, sp);
+    if (!count_enemies(b, fi, FIGHT_ROW, AVOID_ROW, SELECT_ADVANCE | SELECT_FIND)) {
+        message *m =
+            msg_message("battle::out_of_range", "mage spell", fi->unit, sp);
+        message_all(b, m);
+        msg_release(m);
+        return 0;
+    }
+
+    at.fighter = fi;
+    at.index = 0;
+
+    fgs = fighters(b, fi->side, FIGHT_ROW, AVOID_ROW, FS_ENEMY);
+    for (qi = 0, ql = fgs; ql; ql_advance(&ql, &qi, 1)) {
+        fighter *df = (fighter *)ql_get(ql, qi);
+        int n = df->alive - df->removed;
+        troop dt;
+
+        dt.fighter = df;
+        while (n != 0) {
+            dt.index = --n;
+            killed += terminate(dt, at, AT_COMBATSPELL, damage, false);
+            if (--force == 0)
+                break;
+        }
+        if (force == 0)
+            break;
+    }
+    ql_free(fgs);
+
+    m =
+        msg_message("battle::combatspell", "mage spell killed", fi->unit, sp,
+        killed);
     message_all(b, m);
     msg_release(m);
-    return 0;
-  }
-
-  at.fighter = fi;
-  at.index = 0;
-
-  fgs = fighters(b, fi->side, FIGHT_ROW, AVOID_ROW, FS_ENEMY);
-  for (qi = 0, ql = fgs; ql; ql_advance(&ql, &qi, 1)) {
-    fighter *df = (fighter *) ql_get(ql, qi);
-    int n = df->alive - df->removed;
-    troop dt;
-
-    dt.fighter = df;
-    while (n != 0) {
-      dt.index = --n;
-      killed += terminate(dt, at, AT_COMBATSPELL, damage, false);
-      if (--force == 0)
-        break;
-    }
-    if (force == 0)
-      break;
-  }
-  ql_free(fgs);
-
-  m =
-    msg_message("battle::combatspell", "mage spell killed", fi->unit, sp,
-    killed);
-  message_all(b, m);
-  msg_release(m);
-  return level;
+    return level;
 }
 
 int sp_drainodem(fighter * fi, int level, double power, spell * sp)
 {
-  battle *b = fi->side->battle;
-  troop dt;
-  troop at;
-  int force, enemies;
-  int drained = 0;
-  int killed = 0;
-  const char *damage;
-  message *m;
+    battle *b = fi->side->battle;
+    troop dt;
+    troop at;
+    int force, enemies;
+    int drained = 0;
+    int killed = 0;
+    const char *damage;
+    message *m;
 
-  /* 11-26 HP */
-  damage = spell_damage(4);
-  /* Jungdrache 3->54, Drache 6->216, Wyrm 12->864 Treffer */
-  force = lovar(get_force(power, 6));
+    /* 11-26 HP */
+    damage = spell_damage(4);
+    /* Jungdrache 3->54, Drache 6->216, Wyrm 12->864 Treffer */
+    force = lovar(get_force(power, 6));
 
-  enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE);
+    enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE);
 
-  if (!enemies) {
-    m = msg_message("battle::out_of_range", "mage spell", fi->unit, sp);
+    if (!enemies) {
+        m = msg_message("battle::out_of_range", "mage spell", fi->unit, sp);
+        message_all(b, m);
+        msg_release(m);
+        return 0;
+    }
+
+    at.fighter = fi;
+    at.index = 0;
+
+    while (force && drained < enemies) {
+        dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE);
+        assert(dt.fighter);
+        if (hits(at, dt, NULL)) {
+            drain_exp(dt.fighter->unit, 90);
+            ++drained;
+            killed += terminate(dt, at, AT_COMBATSPELL, damage, false);
+        }
+        --force;
+    }
+
+    m =
+        msg_message("cast_drainlife_effect", "mage spell amount", fi->unit, sp,
+        drained);
     message_all(b, m);
     msg_release(m);
-    return 0;
-  }
-
-  at.fighter = fi;
-  at.index = 0;
-
-  while (force && drained < enemies) {
-    dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE);
-    assert(dt.fighter);
-    if (hits(at, dt, NULL)) {
-      drain_exp(dt.fighter->unit, 90);
-      ++drained;
-      killed += terminate(dt, at, AT_COMBATSPELL, damage, false);
-    }
-    --force;
-  }
-
-  m =
-    msg_message("cast_drainlife_effect", "mage spell amount", fi->unit, sp,
-    drained);
-  message_all(b, m);
-  msg_release(m);
-  return level;
+    return level;
 }
 
 /* ------------------------------------------------------------- */
@@ -786,64 +791,103 @@ int sp_drainodem(fighter * fi, int level, double power, spell * sp)
 
 int sp_shadowcall(struct castorder * co)
 {
-  fighter * fi = co->magician.fig;
-  int level = co->level;
-  double power = co->force;
-  battle *b = fi->side->battle;
-  region *r = b->region;
-  unit *mage = fi->unit;
-  attrib *a;
-  int force = (int)(get_force(power, 3) / 2);
-  unit *u;
-  const char *races[3] = { "shadowbat", "nightmare", "vampunicorn" };
-  const race *rc = rc_find(races[rng_int() % 3]);
-  message *msg;
+    fighter * fi = co->magician.fig;
+    int level = co->level;
+    double power = co->force;
+    battle *b = fi->side->battle;
+    region *r = b->region;
+    unit *mage = fi->unit;
+    attrib *a;
+    int force = (int)(get_force(power, 3) / 2);
+    unit *u;
+    const char *races[3] = { "shadowbat", "nightmare", "vampunicorn" };
+    const race *rc = rc_find(races[rng_int() % 3]);
+    message *msg;
 
-  u = create_unit(r, mage->faction, force, rc, 0, NULL, mage);
-  setstatus(u, ST_FIGHT);
+    u = create_unit(r, mage->faction, force, rc, 0, NULL, mage);
+    setstatus(u, ST_FIGHT);
 
-  set_level(u, SK_WEAPONLESS, (int)(power / 2));
-  set_level(u, SK_STAMINA, (int)(power / 2));
-  u->hp = u->number * unit_max_hp(u);
+    set_level(u, SK_WEAPONLESS, (int)(power / 2));
+    set_level(u, SK_STAMINA, (int)(power / 2));
+    u->hp = u->number * unit_max_hp(u);
 
-  a = a_new(&at_unitdissolve);
-  a->data.ca[0] = 0;
-  a->data.ca[1] = 100;
-  a_add(&u->attribs, a);
+    a = a_new(&at_unitdissolve);
+    a->data.ca[0] = 0;
+    a->data.ca[1] = 100;
+    a_add(&u->attribs, a);
 
-  make_fighter(b, u, fi->side, is_attacker(fi));
-  msg =
-    msg_message("sp_shadowcall_effect", "mage amount race", mage, u->number,
-    u_race(u));
-  message_all(b, msg);
-  msg_release(msg);
-  return level;
+    make_fighter(b, u, fi->side, is_attacker(fi));
+    msg =
+        msg_message("sp_shadowcall_effect", "mage amount race", mage, u->number,
+        u_race(u));
+    message_all(b, msg);
+    msg_release(msg);
+    return level;
 }
 
 int sp_wolfhowl(struct castorder * co)
 {
-  fighter * fi = co->magician.fig;
-  int level = co->level;
-  double power = co->force;
-  battle *b = fi->side->battle;
-  region *r = b->region;
-  unit *mage = fi->unit;
-  attrib *a;
-  message *msg;
-  int force = (int)(get_force(power, 3) / 2);
-  const race * rc = get_race(RC_WOLF);
-  if (force>0) {
-    unit *u =
-      create_unit(r, mage->faction, force, rc, 0, NULL, mage);
-    leave(u, true);
+    fighter * fi = co->magician.fig;
+    int level = co->level;
+    double power = co->force;
+    battle *b = fi->side->battle;
+    region *r = b->region;
+    unit *mage = fi->unit;
+    attrib *a;
+    message *msg;
+    int force = (int)(get_force(power, 3) / 2);
+    const race * rc = get_race(RC_WOLF);
+    if (force > 0) {
+        unit *u =
+            create_unit(r, mage->faction, force, rc, 0, NULL, mage);
+        leave(u, true);
+        setstatus(u, ST_FIGHT);
+
+        set_level(u, SK_WEAPONLESS, (int)(power / 3));
+        set_level(u, SK_STAMINA, (int)(power / 3));
+        u->hp = u->number * unit_max_hp(u);
+
+        if (fval(mage, UFL_ANON_FACTION)) {
+            fset(u, UFL_ANON_FACTION);
+        }
+
+        a = a_new(&at_unitdissolve);
+        a->data.ca[0] = 0;
+        a->data.ca[1] = 100;
+        a_add(&u->attribs, a);
+
+        make_fighter(b, u, fi->side, is_attacker(fi));
+    }
+    msg =
+        msg_message("sp_wolfhowl_effect", "mage amount race", mage, force, rc);
+    message_all(b, msg);
+    msg_release(msg);
+
+    return level;
+}
+
+int sp_shadowknights(struct castorder * co)
+{
+    fighter * fi = co->magician.fig;
+    int level = co->level;
+    double power = co->force;
+    unit *u;
+    battle *b = fi->side->battle;
+    region *r = b->region;
+    unit *mage = fi->unit;
+    attrib *a;
+    int force = _max(1, (int)get_force(power, 3));
+    message *msg;
+
+    u =
+        create_unit(r, mage->faction, force, get_race(RC_SHADOWKNIGHT), 0, NULL,
+        mage);
     setstatus(u, ST_FIGHT);
 
-    set_level(u, SK_WEAPONLESS, (int)(power / 3));
-    set_level(u, SK_STAMINA, (int)(power / 3));
     u->hp = u->number * unit_max_hp(u);
-    
+
     if (fval(mage, UFL_ANON_FACTION)) {
-      fset(u, UFL_ANON_FACTION);
+        fset(u, UFL_ANON_FACTION);
     }
 
     a = a_new(&at_unitdissolve);
@@ -852,84 +896,45 @@ int sp_wolfhowl(struct castorder * co)
     a_add(&u->attribs, a);
 
     make_fighter(b, u, fi->side, is_attacker(fi));
-  }
-  msg =
-    msg_message("sp_wolfhowl_effect", "mage amount race", mage, force, rc);
-  message_all(b, msg);
-  msg_release(msg);
 
-  return level;
-}
+    msg = msg_message("sp_shadowknights_effect", "mage", mage);
+    message_all(b, msg);
+    msg_release(msg);
 
-int sp_shadowknights(struct castorder * co)
-{
-  fighter * fi = co->magician.fig;
-  int level = co->level;
-  double power = co->force;
-  unit *u;
-  battle *b = fi->side->battle;
-  region *r = b->region;
-  unit *mage = fi->unit;
-  attrib *a;
-  int force = _max(1, (int)get_force(power, 3));
-  message *msg;
-
-  u =
-      create_unit(r, mage->faction, force, get_race(RC_SHADOWKNIGHT), 0, NULL,
-    mage);
-  setstatus(u, ST_FIGHT);
-
-  u->hp = u->number * unit_max_hp(u);
-
-  if (fval(mage, UFL_ANON_FACTION)) {
-    fset(u, UFL_ANON_FACTION);
-  }
-
-  a = a_new(&at_unitdissolve);
-  a->data.ca[0] = 0;
-  a->data.ca[1] = 100;
-  a_add(&u->attribs, a);
-
-  make_fighter(b, u, fi->side, is_attacker(fi));
-
-  msg = msg_message("sp_shadowknights_effect", "mage", mage);
-  message_all(b, msg);
-  msg_release(msg);
-
-  return level;
+    return level;
 }
 
 int sp_strong_wall(struct castorder * co)
 {
-  fighter * fi = co->magician.fig;
-  int level = co->level;
-  float power = co->force;
-  battle *b = fi->side->battle;
-  unit *mage = fi->unit;
-  building *burg;
-  float effect;
-  static bool init = false;
-  message *msg;
-  static const curse_type *strongwall_ct;
-  if (!init) {
-    init = true;
-    strongwall_ct = ct_find("strongwall");
-  }
+    fighter * fi = co->magician.fig;
+    int level = co->level;
+    float power = co->force;
+    battle *b = fi->side->battle;
+    unit *mage = fi->unit;
+    building *burg;
+    float effect;
+    static bool init = false;
+    message *msg;
+    static const curse_type *strongwall_ct;
+    if (!init) {
+        init = true;
+        strongwall_ct = ct_find("strongwall");
+    }
 
-  if (!mage->building) {
-    return 0;
-  }
-  burg = mage->building;
+    if (!mage->building) {
+        return 0;
+    }
+    burg = mage->building;
 
-  effect = power / 4;
-  create_curse(mage, &burg->attribs, strongwall_ct, power, 1, effect, 0);
+    effect = power / 4;
+    create_curse(mage, &burg->attribs, strongwall_ct, power, 1, effect, 0);
 
-  msg =
-    msg_message("sp_strongwalls_effect", "mage building", mage, mage->building);
-  message_all(b, msg);
-  msg_release(msg);
+    msg =
+        msg_message("sp_strongwalls_effect", "mage building", mage, mage->building);
+    message_all(b, msg);
+    msg_release(msg);
 
-  return level;
+    return level;
 }
 
 /** Spells: chaosrow / song of confusion.
@@ -937,88 +942,89 @@ int sp_strong_wall(struct castorder * co)
  */
 int sp_chaosrow(struct castorder * co)
 {
-  fighter * fi = co->magician.fig;
-  int level = co->level;
-  double power = co->force;
-  const spell * sp = co->sp;
-  battle *b = fi->side->battle;
-  unit *mage = fi->unit;
-  quicklist *fgs, *ql;
-  message *m;
-  const char *mtype;
-  int qi, k = 0;
+    fighter * fi = co->magician.fig;
+    int level = co->level;
+    double power = co->force;
+    const spell * sp = co->sp;
+    battle *b = fi->side->battle;
+    unit *mage = fi->unit;
+    quicklist *fgs, *ql;
+    message *m;
+    const char *mtype;
+    int qi, k = 0;
 
-  if (!count_enemies(b, fi, FIGHT_ROW, NUMROWS, SELECT_ADVANCE | SELECT_FIND)) {
-    m = msg_message("battle::out_of_range", "mage spell", fi->unit, sp);
+    if (!count_enemies(b, fi, FIGHT_ROW, NUMROWS, SELECT_ADVANCE | SELECT_FIND)) {
+        m = msg_message("battle::out_of_range", "mage spell", fi->unit, sp);
+        message_all(b, m);
+        msg_release(m);
+        return 0;
+    }
+
+    if (sp->id == SPL_CHAOSROW)
+        power *= 40;
+    else
+        power = get_force(power, 5);
+
+    fgs = fighters(b, fi->side, FIGHT_ROW, NUMROWS, FS_ENEMY);
+    scramble_fighters(fgs);
+
+    for (qi = 0, ql = fgs; ql; ql_advance(&ql, &qi, 1)) {
+        fighter *df = (fighter *)ql_get(ql, qi);
+        int n = df->unit->number;
+
+        if (df->alive == 0)
+            continue;
+        if (power <= 0.0)
+            break;
+        /* force sollte wegen des _max(0,x) nicht unter 0 fallen k�nnen */
+
+        if (is_magic_resistant(mage, df->unit, 0))
+            continue;
+
+        if (chance(power / n)) {
+            int row = statusrow(df->status);
+            df->side->size[row] -= df->alive;
+            if (u_race(df->unit)->battle_flags & BF_NOBLOCK) {
+                df->side->nonblockers[row] -= df->alive;
+            }
+            row = FIRST_ROW + (rng_int() % (LAST_ROW - FIRST_ROW));
+            switch (row) {
+            case FIGHT_ROW:
+                df->status = ST_FIGHT;
+                break;
+            case BEHIND_ROW:
+                df->status = ST_CHICKEN;
+                break;
+            case AVOID_ROW:
+                df->status = ST_AVOID;
+                break;
+            case FLEE_ROW:
+                df->status = ST_FLEE;
+                break;
+            default:
+                assert(!"unknown combatrow");
+            }
+            assert(statusrow(df->status) == row);
+            df->side->size[row] += df->alive;
+            if (u_race(df->unit)->battle_flags & BF_NOBLOCK) {
+                df->side->nonblockers[row] += df->alive;
+            }
+            k += df->alive;
+        }
+        power = _max(0, power - n);
+    }
+    ql_free(fgs);
+
+    if (sp->id == SPL_CHAOSROW) {
+        mtype = (k > 0) ? "sp_chaosrow_effect_1" : "sp_chaosrow_effect_0";
+    }
+    else {
+        mtype = (k > 0) ? "sp_confusion_effect_1" : "sp_confusion_effect_0";
+    }
+    m = msg_message(mtype, "mage", mage);
     message_all(b, m);
     msg_release(m);
-    return 0;
-  }
-
-  if (sp->id == SPL_CHAOSROW)
-    power *= 40;
-  else
-    power = get_force(power, 5);
-
-  fgs = fighters(b, fi->side, FIGHT_ROW, NUMROWS, FS_ENEMY);
-  scramble_fighters(fgs);
-
-  for (qi = 0, ql = fgs; ql; ql_advance(&ql, &qi, 1)) {
-    fighter *df = (fighter *) ql_get(ql, qi);
-    int n = df->unit->number;
-
-    if (df->alive == 0)
-      continue;
-    if (power <= 0.0)
-      break;
-    /* force sollte wegen des _max(0,x) nicht unter 0 fallen k�nnen */
-
-    if (is_magic_resistant(mage, df->unit, 0))
-      continue;
-
-    if (chance(power / n)) {
-      int row = statusrow(df->status);
-      df->side->size[row] -= df->alive;
-      if (u_race(df->unit)->battle_flags & BF_NOBLOCK) {
-        df->side->nonblockers[row] -= df->alive;
-      }
-      row = FIRST_ROW + (rng_int() % (LAST_ROW - FIRST_ROW));
-      switch (row) {
-        case FIGHT_ROW:
-          df->status = ST_FIGHT;
-          break;
-        case BEHIND_ROW:
-          df->status = ST_CHICKEN;
-          break;
-        case AVOID_ROW:
-          df->status = ST_AVOID;
-          break;
-        case FLEE_ROW:
-          df->status = ST_FLEE;
-          break;
-        default:
-          assert(!"unknown combatrow");
-      }
-      assert(statusrow(df->status) == row);
-      df->side->size[row] += df->alive;
-      if (u_race(df->unit)->battle_flags & BF_NOBLOCK) {
-        df->side->nonblockers[row] += df->alive;
-      }
-      k += df->alive;
-    }
-    power = _max(0, power - n);
-  }
-  ql_free(fgs);
-
-  if (sp->id == SPL_CHAOSROW) {
-    mtype = (k > 0) ? "sp_chaosrow_effect_1" : "sp_chaosrow_effect_0";
-  } else {
-    mtype = (k > 0) ? "sp_confusion_effect_1" : "sp_confusion_effect_0";
-  }
-  m = msg_message(mtype, "mage", mage);
-  message_all(b, m);
-  msg_release(m);
-  return level;
+    return level;
 }
 
 /* Gesang der Furcht (Kampfzauber) */
@@ -1026,349 +1032,350 @@ int sp_chaosrow(struct castorder * co)
 
 int sp_flee(struct castorder * co)
 {
-  fighter * fi = co->magician.fig;
-  int level = co->level;
-  double power = co->force;
-  const spell * sp = co->sp;
-  battle *b = fi->side->battle;
-  unit *mage = fi->unit;
-  quicklist *fgs, *ql;
-  int force, n, qi;
-  int panik = 0;
-  message *msg;
+    fighter * fi = co->magician.fig;
+    int level = co->level;
+    double power = co->force;
+    const spell * sp = co->sp;
+    battle *b = fi->side->battle;
+    unit *mage = fi->unit;
+    quicklist *fgs, *ql;
+    int force, n, qi;
+    int panik = 0;
+    message *msg;
 
-  switch (sp->id) {
+    switch (sp->id) {
     case SPL_FLEE:
-      force = (int)get_force(power, 4);
-      break;
+        force = (int)get_force(power, 4);
+        break;
     case SPL_SONG_OF_FEAR:
-      force = (int)get_force(power, 3);
-      break;
+        force = (int)get_force(power, 3);
+        break;
     case SPL_AURA_OF_FEAR:
-      force = (int)get_force(power, 5);
-      break;
+        force = (int)get_force(power, 5);
+        break;
     default:
-      force = (int)get_force(power, 10);
-  }
+        force = (int)get_force(power, 10);
+    }
 
-  if (!count_enemies(b, fi, FIGHT_ROW, AVOID_ROW, SELECT_ADVANCE | SELECT_FIND)) {
-    msg = msg_message("sp_flee_effect_0", "mage spell", mage, sp);
+    if (!count_enemies(b, fi, FIGHT_ROW, AVOID_ROW, SELECT_ADVANCE | SELECT_FIND)) {
+        msg = msg_message("sp_flee_effect_0", "mage spell", mage, sp);
+        message_all(b, msg);
+        msg_release(msg);
+        return 0;
+    }
+
+    fgs = fighters(b, fi->side, FIGHT_ROW, AVOID_ROW, FS_ENEMY);
+    scramble_fighters(fgs);
+
+    for (qi = 0, ql = fgs; ql; ql_advance(&ql, &qi, 1)) {
+        fighter *df = (fighter *)ql_get(ql, qi);
+
+        for (n = 0; n != df->alive; ++n) {
+            if (force < 0)
+                break;
+
+            if (df->person[n].flags & FL_PANICED) {   /* bei SPL_SONG_OF_FEAR m�glich */
+                df->person[n].attack -= 1;
+                --force;
+                ++panik;
+            }
+            else if (!(df->person[n].flags & FL_COURAGE)
+                || !fval(u_race(df->unit), RCF_UNDEAD)) {
+                if (!is_magic_resistant(mage, df->unit, 0)) {
+                    df->person[n].flags |= FL_PANICED;
+                    ++panik;
+                }
+                --force;
+            }
+        }
+    }
+    ql_free(fgs);
+
+    msg = msg_message("sp_flee_effect_1", "mage spell amount", mage, sp, panik);
     message_all(b, msg);
     msg_release(msg);
-    return 0;
-  }
 
-  fgs = fighters(b, fi->side, FIGHT_ROW, AVOID_ROW, FS_ENEMY);
-  scramble_fighters(fgs);
-
-  for (qi = 0, ql = fgs; ql; ql_advance(&ql, &qi, 1)) {
-    fighter *df = (fighter *) ql_get(ql, qi);
-
-    for (n = 0; n != df->alive; ++n) {
-      if (force < 0)
-        break;
-
-      if (df->person[n].flags & FL_PANICED) {   /* bei SPL_SONG_OF_FEAR m�glich */
-        df->person[n].attack -= 1;
-        --force;
-        ++panik;
-      } else if (!(df->person[n].flags & FL_COURAGE)
-        || !fval(u_race(df->unit), RCF_UNDEAD)) {
-        if (!is_magic_resistant(mage, df->unit, 0)) {
-          df->person[n].flags |= FL_PANICED;
-          ++panik;
-        }
-        --force;
-      }
-    }
-  }
-  ql_free(fgs);
-
-  msg = msg_message("sp_flee_effect_1", "mage spell amount", mage, sp, panik);
-  message_all(b, msg);
-  msg_release(msg);
-
-  return level;
+    return level;
 }
 
 /* Heldenmut */
 int sp_hero(struct castorder * co)
 {
-  fighter * fi = co->magician.fig;
-  int level = co->level;
-  double power = co->force;
-  const spell * sp = co->sp;
-  battle *b = fi->side->battle;
-  int df_bonus = 0;
-  int force = 0;
-  int allies;
-  int targets = 0;
-  message *m;
+    fighter * fi = co->magician.fig;
+    int level = co->level;
+    double power = co->force;
+    const spell * sp = co->sp;
+    battle *b = fi->side->battle;
+    int df_bonus = 0;
+    int force = 0;
+    int allies;
+    int targets = 0;
+    message *m;
 
-  switch (sp->id) {
+    switch (sp->id) {
     case SPL_HERO:
-      df_bonus = (int)(power / 5);
-      force = _max(1, lovar(get_force(power, 4)));
-      break;
+        df_bonus = (int)(power / 5);
+        force = _max(1, lovar(get_force(power, 4)));
+        break;
 
     default:
-      df_bonus = 1;
-      force = _max(1, (int)power);
-  }
-
-  allies =
-    count_allies(fi->side, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE, ALLY_ANY);
-  /* maximal 2*allies Versuche ein Opfer zu finden, ansonsten best�nde
-   * die Gefahr eine Endlosschleife*/
-  allies *= 2;
-
-  while (force && allies) {
-    troop dt = select_ally(fi, FIGHT_ROW, BEHIND_ROW, ALLY_ANY);
-    fighter *df = dt.fighter;
-    --allies;
-
-    if (df) {
-      if (!(df->person[dt.index].flags & FL_COURAGE)) {
-        df->person[dt.index].defence += df_bonus;
-        df->person[dt.index].flags = df->person[dt.index].flags | FL_COURAGE;
-        targets++;
-        --force;
-      }
+        df_bonus = 1;
+        force = _max(1, (int)power);
     }
-  }
 
-  m =
-    msg_message("cast_hero_effect", "mage spell amount", fi->unit, sp, targets);
-  message_all(b, m);
-  msg_release(m);
+    allies =
+        count_allies(fi->side, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE, ALLY_ANY);
+    /* maximal 2*allies Versuche ein Opfer zu finden, ansonsten best�nde
+     * die Gefahr eine Endlosschleife*/
+    allies *= 2;
 
-  return level;
+    while (force && allies) {
+        troop dt = select_ally(fi, FIGHT_ROW, BEHIND_ROW, ALLY_ANY);
+        fighter *df = dt.fighter;
+        --allies;
+
+        if (df) {
+            if (!(df->person[dt.index].flags & FL_COURAGE)) {
+                df->person[dt.index].defence += df_bonus;
+                df->person[dt.index].flags = df->person[dt.index].flags | FL_COURAGE;
+                targets++;
+                --force;
+            }
+        }
+    }
+
+    m =
+        msg_message("cast_hero_effect", "mage spell amount", fi->unit, sp, targets);
+    message_all(b, m);
+    msg_release(m);
+
+    return level;
 }
 
 int sp_berserk(struct castorder * co)
 {
-  fighter * fi = co->magician.fig;
-  int level = co->level;
-  double power = co->force;
-  const spell * sp = co->sp;
-  battle *b = fi->side->battle;
-  int at_bonus = 0;
-  int df_malus = 0;
-  int force = 0;
-  int allies = 0;
-  int targets = 0;
-  message *m;
+    fighter * fi = co->magician.fig;
+    int level = co->level;
+    double power = co->force;
+    const spell * sp = co->sp;
+    battle *b = fi->side->battle;
+    int at_bonus = 0;
+    int df_malus = 0;
+    int force = 0;
+    int allies = 0;
+    int targets = 0;
+    message *m;
 
-  switch (sp->id) {
+    switch (sp->id) {
     case SPL_BERSERK:
     case SPL_BLOODTHIRST:
-      at_bonus = _max(1, level / 3);
-      df_malus = 2;
-      force = (int)get_force(power, 2);
-      break;
+        at_bonus = _max(1, level / 3);
+        df_malus = 2;
+        force = (int)get_force(power, 2);
+        break;
 
     default:
-      at_bonus = 1;
-      df_malus = 0;
-      force = (int)power;
-  }
-
-  allies =
-    count_allies(fi->side, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE, ALLY_ANY);
-  /* maximal 2*allies Versuche ein Opfer zu finden, ansonsten best�nde
-   * die Gefahr eine Endlosschleife*/
-  allies *= 2;
-
-  while (force && allies) {
-    troop dt = select_ally(fi, FIGHT_ROW, BEHIND_ROW - 1, ALLY_ANY);
-    fighter *df = dt.fighter;
-    --allies;
-
-    if (df) {
-      if (!(df->person[dt.index].flags & FL_COURAGE)) {
-        df->person[dt.index].attack += at_bonus;
-        df->person[dt.index].defence -= df_malus;
-        df->person[dt.index].flags = df->person[dt.index].flags | FL_COURAGE;
-        targets++;
-        --force;
-      }
+        at_bonus = 1;
+        df_malus = 0;
+        force = (int)power;
     }
-  }
 
-  m =
-    msg_message("cast_berserk_effect", "mage spell amount", fi->unit, sp,
-    targets);
-  message_all(b, m);
-  msg_release(m);
-  return level;
+    allies =
+        count_allies(fi->side, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE, ALLY_ANY);
+    /* maximal 2*allies Versuche ein Opfer zu finden, ansonsten best�nde
+     * die Gefahr eine Endlosschleife*/
+    allies *= 2;
+
+    while (force && allies) {
+        troop dt = select_ally(fi, FIGHT_ROW, BEHIND_ROW - 1, ALLY_ANY);
+        fighter *df = dt.fighter;
+        --allies;
+
+        if (df) {
+            if (!(df->person[dt.index].flags & FL_COURAGE)) {
+                df->person[dt.index].attack += at_bonus;
+                df->person[dt.index].defence -= df_malus;
+                df->person[dt.index].flags = df->person[dt.index].flags | FL_COURAGE;
+                targets++;
+                --force;
+            }
+        }
+    }
+
+    m =
+        msg_message("cast_berserk_effect", "mage spell amount", fi->unit, sp,
+        targets);
+    message_all(b, m);
+    msg_release(m);
+    return level;
 }
 
 int sp_frighten(struct castorder * co)
 {
-  fighter * fi = co->magician.fig;
-  int level = co->level;
-  double power = co->force;
-  const spell * sp = co->sp;
-  battle *b = fi->side->battle;
-  unit *mage = fi->unit;
-  int at_malus = 0;
-  int df_malus = 0;
-  int force = 0;
-  int enemies = 0;
-  int targets = 0;
-  message *m;
+    fighter * fi = co->magician.fig;
+    int level = co->level;
+    double power = co->force;
+    const spell * sp = co->sp;
+    battle *b = fi->side->battle;
+    unit *mage = fi->unit;
+    int at_malus = 0;
+    int df_malus = 0;
+    int force = 0;
+    int enemies = 0;
+    int targets = 0;
+    message *m;
 
-  at_malus = _max(1, level - 4);
-  df_malus = 2;
-  force = (int)get_force(power, 2);
+    at_malus = _max(1, level - 4);
+    df_malus = 2;
+    force = (int)get_force(power, 2);
 
-  enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE);
-  if (!enemies) {
-    message *m =
-      msg_message("battle::out_of_range", "mage spell", fi->unit, sp);
+    enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE);
+    if (!enemies) {
+        message *m =
+            msg_message("battle::out_of_range", "mage spell", fi->unit, sp);
+        message_all(b, m);
+        msg_release(m);
+        return 0;
+    }
+
+    while (force && enemies) {
+        troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE);
+        fighter *df = dt.fighter;
+        --enemies;
+
+        if (!df)
+            break;
+
+        assert(!helping(fi->side, df->side));
+
+        if (df->person[dt.index].flags & FL_COURAGE) {
+            df->person[dt.index].flags &= ~(FL_COURAGE);
+        }
+        if (!is_magic_resistant(mage, df->unit, 0)) {
+            df->person[dt.index].attack -= at_malus;
+            df->person[dt.index].defence -= df_malus;
+            targets++;
+        }
+        --force;
+    }
+
+    m =
+        msg_message("cast_frighten_effect", "mage spell amount", fi->unit, sp,
+        targets);
     message_all(b, m);
     msg_release(m);
-    return 0;
-  }
-
-  while (force && enemies) {
-    troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE);
-    fighter *df = dt.fighter;
-    --enemies;
-
-    if (!df)
-      break;
-
-    assert(!helping(fi->side, df->side));
-
-    if (df->person[dt.index].flags & FL_COURAGE) {
-      df->person[dt.index].flags &= ~(FL_COURAGE);
-    }
-    if (!is_magic_resistant(mage, df->unit, 0)) {
-      df->person[dt.index].attack -= at_malus;
-      df->person[dt.index].defence -= df_malus;
-      targets++;
-    }
-    --force;
-  }
-
-  m =
-    msg_message("cast_frighten_effect", "mage spell amount", fi->unit, sp,
-    targets);
-  message_all(b, m);
-  msg_release(m);
-  return level;
+    return level;
 }
 
 int sp_tiredsoldiers(struct castorder * co)
 {
-  fighter * fi = co->magician.fig;
-  int level = co->level;
-  double power = co->force;
-  const spell * sp = co->sp;
-  battle *b = fi->side->battle;
-  unit *mage = fi->unit;
-  int n = 0;
-  int force = (int)(power * power * 4);
-  message *m;
+    fighter * fi = co->magician.fig;
+    int level = co->level;
+    double power = co->force;
+    const spell * sp = co->sp;
+    battle *b = fi->side->battle;
+    unit *mage = fi->unit;
+    int n = 0;
+    int force = (int)(power * power * 4);
+    message *m;
 
-  if (!count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW,
-      SELECT_ADVANCE | SELECT_FIND)) {
-    message *m =
-      msg_message("battle::out_of_range", "mage spell", fi->unit, sp);
+    if (!count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW,
+        SELECT_ADVANCE | SELECT_FIND)) {
+        message *m =
+            msg_message("battle::out_of_range", "mage spell", fi->unit, sp);
+        message_all(b, m);
+        msg_release(m);
+        return 0;
+    }
+
+    while (force) {
+        troop t = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
+        fighter *df = t.fighter;
+
+        if (!df)
+            break;
+
+        assert(!helping(fi->side, df->side));
+        if (!(df->person[t.index].flags & FL_TIRED)) {
+            if (!is_magic_resistant(mage, df->unit, 0)) {
+                df->person[t.index].flags = df->person[t.index].flags | FL_TIRED;
+                df->person[t.index].defence -= 2;
+                ++n;
+            }
+        }
+        --force;
+    }
+
+    m = msg_message("cast_tired_effect", "mage spell amount", fi->unit, sp, n);
     message_all(b, m);
     msg_release(m);
-    return 0;
-  }
-
-  while (force) {
-    troop t = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
-    fighter *df = t.fighter;
-
-    if (!df)
-      break;
-
-    assert(!helping(fi->side, df->side));
-    if (!(df->person[t.index].flags & FL_TIRED)) {
-      if (!is_magic_resistant(mage, df->unit, 0)) {
-        df->person[t.index].flags = df->person[t.index].flags | FL_TIRED;
-        df->person[t.index].defence -= 2;
-        ++n;
-      }
-    }
-    --force;
-  }
-
-  m = msg_message("cast_tired_effect", "mage spell amount", fi->unit, sp, n);
-  message_all(b, m);
-  msg_release(m);
-  return level;
+    return level;
 }
 
 int sp_windshield(struct castorder * co)
 {
-  fighter * fi = co->magician.fig;
-  int level = co->level;
-  double power = co->force;
-  const spell * sp = co->sp;
-  battle *b = fi->side->battle;
-  int force, at_malus;
-  int enemies;
-  message *m;
+    fighter * fi = co->magician.fig;
+    int level = co->level;
+    double power = co->force;
+    const spell * sp = co->sp;
+    battle *b = fi->side->battle;
+    int force, at_malus;
+    int enemies;
+    message *m;
 
-  switch (sp->id) {
+    switch (sp->id) {
     case SPL_WINDSHIELD:
-      force = (int)get_force(power, 4);
-      at_malus = level / 4;
-      break;
+        force = (int)get_force(power, 4);
+        at_malus = level / 4;
+        break;
 
     default:
-      force = (int)power;
-      at_malus = 2;
-  }
-  enemies = count_enemies(b, fi, BEHIND_ROW, BEHIND_ROW, SELECT_ADVANCE);
-  if (!enemies) {
-    m = msg_message("battle::out_of_range", "mage spell", fi->unit, sp);
+        force = (int)power;
+        at_malus = 2;
+    }
+    enemies = count_enemies(b, fi, BEHIND_ROW, BEHIND_ROW, SELECT_ADVANCE);
+    if (!enemies) {
+        m = msg_message("battle::out_of_range", "mage spell", fi->unit, sp);
+        message_all(b, m);
+        msg_release(m);
+        return 0;
+    }
+
+    while (force && enemies) {
+        troop dt = select_enemy(fi, BEHIND_ROW, BEHIND_ROW, SELECT_ADVANCE);
+        fighter *df = dt.fighter;
+        --enemies;
+
+        if (!df)
+            break;
+        assert(!helping(fi->side, df->side));
+
+        if (df->person[dt.index].missile) {
+            /* this suxx... affects your melee weapon as well. */
+            df->person[dt.index].attack -= at_malus;
+            --force;
+        }
+    }
+
+    m = msg_message("cast_storm_effect", "mage spell", fi->unit, sp);
     message_all(b, m);
     msg_release(m);
-    return 0;
-  }
-
-  while (force && enemies) {
-    troop dt = select_enemy(fi, BEHIND_ROW, BEHIND_ROW, SELECT_ADVANCE);
-    fighter *df = dt.fighter;
-    --enemies;
-
-    if (!df)
-      break;
-    assert(!helping(fi->side, df->side));
-
-    if (df->person[dt.index].missile) {
-      /* this suxx... affects your melee weapon as well. */
-      df->person[dt.index].attack -= at_malus;
-      --force;
-    }
-  }
-
-  m = msg_message("cast_storm_effect", "mage spell", fi->unit, sp);
-  message_all(b, m);
-  msg_release(m);
-  return level;
+    return level;
 }
 
 int sp_reeling_arrows(struct castorder * co)
 {
-  fighter * fi = co->magician.fig;
-  int level = co->level;
-  const spell * sp = co->sp;
-  battle *b = fi->side->battle;
-  message *m;
+    fighter * fi = co->magician.fig;
+    int level = co->level;
+    const spell * sp = co->sp;
+    battle *b = fi->side->battle;
+    message *m;
 
-  b->reelarrow = true;
-  m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp);
-  message_all(b, m);
-  msg_release(m);
-  return level;
+    b->reelarrow = true;
+    m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp);
+    message_all(b, m);
+    msg_release(m);
+    return level;
 }
 
 /* Magier weicht dem Kampf aus. Wenn er sich bewegen kann, zieht er in
@@ -1376,139 +1383,139 @@ int sp_reeling_arrows(struct castorder * co)
  * bleibt er stehen und nimmt nicht weiter am Kampf teil. */
 int sp_denyattack(struct castorder * co)
 {
-  fighter * fi = co->magician.fig;
-  int level = co->level;
+    fighter * fi = co->magician.fig;
+    int level = co->level;
 
-  const spell * sp = co->sp;
-  battle *b = fi->side->battle;
-  unit *mage = fi->unit;
-  region *r = b->region;
-  message *m;
+    const spell * sp = co->sp;
+    battle *b = fi->side->battle;
+    unit *mage = fi->unit;
+    region *r = b->region;
+    message *m;
 
-  /* Fliehende Einheiten verlassen auf jeden Fall Geb�ude und Schiffe. */
-  if (!fval(r->terrain, SEA_REGION)) {
-    leave(mage, false);
-  }
-  /* und bewachen nicht */
-  setguard(mage, GUARD_NONE);
-  /* irgendwie den langen befehl sperren */
-  /* fset(fi, FIG_ATTACKED); */
+    /* Fliehende Einheiten verlassen auf jeden Fall Geb�ude und Schiffe. */
+    if (!fval(r->terrain, SEA_REGION)) {
+        leave(mage, false);
+    }
+    /* und bewachen nicht */
+    setguard(mage, GUARD_NONE);
+    /* irgendwie den langen befehl sperren */
+    /* fset(fi, FIG_ATTACKED); */
 
-  /* wir tun so, als w�re die Person geflohen */
-  fset(fi, FIG_NOLOOT);
-  fi->run.hp = mage->hp;
-  fi->run.number = mage->number;
-  /* fighter leeren */
-  rmfighter(fi, mage->number);
+    /* wir tun so, als w�re die Person geflohen */
+    fset(fi, FIG_NOLOOT);
+    fi->run.hp = mage->hp;
+    fi->run.number = mage->number;
+    /* fighter leeren */
+    rmfighter(fi, mage->number);
 
-  m = msg_message("cast_escape_effect", "mage spell", fi->unit, sp);
-  message_all(b, m);
-  msg_release(m);
+    m = msg_message("cast_escape_effect", "mage spell", fi->unit, sp);
+    message_all(b, m);
+    msg_release(m);
 
-  return level;
+    return level;
 }
 
 static void do_meffect(fighter * af, int typ, int effect, int duration)
 {
-  battle *b = af->side->battle;
-  meffect *me = (meffect *) malloc(sizeof(struct meffect));
-  ql_push(&b->meffects, me);
-  me->magician = af;
-  me->typ = typ;
-  me->effect = effect;
-  me->duration = duration;
+    battle *b = af->side->battle;
+    meffect *me = (meffect *)malloc(sizeof(struct meffect));
+    ql_push(&b->meffects, me);
+    me->magician = af;
+    me->typ = typ;
+    me->effect = effect;
+    me->duration = duration;
 }
 
 int sp_armorshield(struct castorder * co)
 {
-  fighter * fi = co->magician.fig;
-  int level = co->level;
-  double power = co->force;
-  const spell * sp = co->sp;
-  int effect;
-  int duration;
-  battle *b = fi->side->battle;
-  message *m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp);
+    fighter * fi = co->magician.fig;
+    int level = co->level;
+    double power = co->force;
+    const spell * sp = co->sp;
+    int effect;
+    int duration;
+    battle *b = fi->side->battle;
+    message *m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp);
 
-  message_all(b, m);
-  msg_release(m);
+    message_all(b, m);
+    msg_release(m);
 
-  /* gibt R�stung +effect f�r duration Treffer */
+    /* gibt R�stung +effect f�r duration Treffer */
 
-  switch (sp->id) {
+    switch (sp->id) {
     case SPL_ARMORSHIELD:
-      effect = level / 3;
-      duration = (int)(20 * power * power);
-      break;
+        effect = level / 3;
+        duration = (int)(20 * power * power);
+        break;
 
     default:
-      effect = level / 4;
-      duration = (int)(power * power);
-  }
-  do_meffect(fi, SHIELD_ARMOR, effect, duration);
-  return level;
+        effect = level / 4;
+        duration = (int)(power * power);
+    }
+    do_meffect(fi, SHIELD_ARMOR, effect, duration);
+    return level;
 }
 
 int sp_reduceshield(struct castorder * co)
 {
-  fighter * fi = co->magician.fig;
-  int level = co->level;
-  double power = co->force;
-  const spell * sp = co->sp;
-  int effect;
-  int duration;
-  battle *b = fi->side->battle;
-  message *m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp);
-  message_all(b, m);
-  msg_release(m);
+    fighter * fi = co->magician.fig;
+    int level = co->level;
+    double power = co->force;
+    const spell * sp = co->sp;
+    int effect;
+    int duration;
+    battle *b = fi->side->battle;
+    message *m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp);
+    message_all(b, m);
+    msg_release(m);
 
-  /* jeder Schaden wird um effect% reduziert bis der Schild duration
-   * Trefferpunkte aufgefangen hat */
+    /* jeder Schaden wird um effect% reduziert bis der Schild duration
+     * Trefferpunkte aufgefangen hat */
 
-  switch (sp->id) {
+    switch (sp->id) {
     case SPL_REDUCESHIELD:
-      effect = 50;
-      duration = (int)(50 * power * power);
-      break;
+        effect = 50;
+        duration = (int)(50 * power * power);
+        break;
 
     default:
-      effect = level * 3;
-      duration = (int)get_force(power, 5);
-  }
-  do_meffect(fi, SHIELD_REDUCE, effect, duration);
-  return level;
+        effect = level * 3;
+        duration = (int)get_force(power, 5);
+    }
+    do_meffect(fi, SHIELD_REDUCE, effect, duration);
+    return level;
 }
 
 int sp_fumbleshield(struct castorder * co)
 {
-  fighter * fi = co->magician.fig;
-  int level = co->level;
-  const spell * sp = co->sp;
-  int effect;
-  int duration;
-  battle *b = fi->side->battle;
-  message *m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp);
+    fighter * fi = co->magician.fig;
+    int level = co->level;
+    const spell * sp = co->sp;
+    int effect;
+    int duration;
+    battle *b = fi->side->battle;
+    message *m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp);
 
-  message_all(b, m);
-  msg_release(m);
+    message_all(b, m);
+    msg_release(m);
 
-  /* der erste Zauber schl�gt mit 100% fehl  */
+    /* der erste Zauber schl�gt mit 100% fehl  */
 
-  switch (sp->id) {
+    switch (sp->id) {
     case SPL_DRAIG_FUMBLESHIELD:
     case SPL_GWYRRD_FUMBLESHIELD:
     case SPL_CERRDOR_FUMBLESHIELD:
     case SPL_TYBIED_FUMBLESHIELD:
-      duration = 100;
-      effect = _max(1, 25 - level);
-      break;
+        duration = 100;
+        effect = _max(1, 25 - level);
+        break;
 
     default:
-      duration = 100;
-      effect = 10;
-  }
-  do_meffect(fi, SHIELD_BLOCK, effect, duration);
-  return level;
+        duration = 100;
+        effect = 10;
+    }
+    do_meffect(fi, SHIELD_BLOCK, effect, duration);
+    return level;
 }
 
 /* ------------------------------------------------------------- */
@@ -1516,287 +1523,291 @@ int sp_fumbleshield(struct castorder * co)
 
 static int count_healable(battle * b, fighter * df)
 {
-  side *s;
-  int healable = 0;
+    side *s;
+    int healable = 0;
 
-  for (s = b->sides; s != b->sides + b->nsides; ++s) {
-    if (helping(df->side, s)) {
-      healable += s->casualties;
+    for (s = b->sides; s != b->sides + b->nsides; ++s) {
+        if (helping(df->side, s)) {
+            healable += s->casualties;
+        }
     }
-  }
-  return healable;
+    return healable;
 }
 static bool has_ao_healing(const unit *u) {
     item *const* iter = i_findc(&u->items, it_find("ao_healing"));
-    return (*iter && (*iter)->number>0);
+    return (*iter && (*iter)->number > 0);
 }
 
 /* wiederbeleben */
 int sp_reanimate(struct castorder * co)
 {
-  fighter * fi = co->magician.fig;
-  int level = co->level;
-  double power = co->force;
-  battle *b = fi->side->battle;
-  unit *mage = fi->unit;
-  int healable, j = 0;
-  double c = 0.50 + 0.02 * power;
-  double k = EFFECT_HEALING_SPELL * power;
-  bool use_item = has_ao_healing(mage);
-  message *msg;
+    fighter * fi = co->magician.fig;
+    int level = co->level;
+    double power = co->force;
+    battle *b = fi->side->battle;
+    unit *mage = fi->unit;
+    int healable, j = 0;
+    double c = 0.50 + 0.02 * power;
+    double k = EFFECT_HEALING_SPELL * power;
+    bool use_item = has_ao_healing(mage);
+    message *msg;
 
-  if (use_item) {
-    k *= 2;
-    c += 0.10;
-  }
-
-  healable = count_healable(b, fi);
-  healable = (int)_min(k, healable);
-  while (healable--) {
-    fighter *tf = select_corpse(b, fi);
-    if (tf != NULL && tf->side->casualties > 0
-        && u_race(tf->unit) != get_race(RC_DAEMON)
-      && (chance(c))) {
-      assert(tf->alive < tf->unit->number);
-      /* t.fighter->person[].hp beginnt mit t.index = 0 zu z�hlen,
-       * t.fighter->alive ist jedoch die Anzahl lebender in der Einheit,
-       * also sind die hp von t.fighter->alive
-       * t.fighter->hitpoints[t.fighter->alive-1] und der erste Tote
-       * oder weggelaufene ist t.fighter->hitpoints[tf->alive] */
-      tf->person[tf->alive].hp = 2;
-      ++tf->alive;
-      ++tf->side->size[SUM_ROW];
-      ++tf->side->size[tf->unit->status + 1];
-      ++tf->side->healed;
-      --tf->side->casualties;
-      assert(tf->side->casualties >= 0);
-      --tf->side->dead;
-      assert(tf->side->dead >= 0);
-      ++j;
+    if (use_item) {
+        k *= 2;
+        c += 0.10;
     }
-  }
-  if (j <= 0) {
-    level = j;
-  }
-  if (use_item) {
-    msg =
-      msg_message("reanimate_effect_1", "mage amount item", mage, j,
-      get_resourcetype(R_AMULET_OF_HEALING));
-  } else {
-    msg = msg_message("reanimate_effect_0", "mage amount", mage, j);
-  }
-  message_all(b, msg);
-  msg_release(msg);
 
-  return level;
+    healable = count_healable(b, fi);
+    healable = (int)_min(k, healable);
+    while (healable--) {
+        fighter *tf = select_corpse(b, fi);
+        if (tf != NULL && tf->side->casualties > 0
+            && u_race(tf->unit) != get_race(RC_DAEMON)
+            && (chance(c))) {
+            assert(tf->alive < tf->unit->number);
+            /* t.fighter->person[].hp beginnt mit t.index = 0 zu z�hlen,
+             * t.fighter->alive ist jedoch die Anzahl lebender in der Einheit,
+             * also sind die hp von t.fighter->alive
+             * t.fighter->hitpoints[t.fighter->alive-1] und der erste Tote
+             * oder weggelaufene ist t.fighter->hitpoints[tf->alive] */
+            tf->person[tf->alive].hp = 2;
+            ++tf->alive;
+            ++tf->side->size[SUM_ROW];
+            ++tf->side->size[tf->unit->status + 1];
+            ++tf->side->healed;
+            --tf->side->casualties;
+            assert(tf->side->casualties >= 0);
+            --tf->side->dead;
+            assert(tf->side->dead >= 0);
+            ++j;
+        }
+    }
+    if (j <= 0) {
+        level = j;
+    }
+    if (use_item) {
+        msg =
+            msg_message("reanimate_effect_1", "mage amount item", mage, j,
+            get_resourcetype(R_AMULET_OF_HEALING));
+    }
+    else {
+        msg = msg_message("reanimate_effect_0", "mage amount", mage, j);
+    }
+    message_all(b, msg);
+    msg_release(msg);
+
+    return level;
 }
 
 int sp_keeploot(struct castorder * co)
 {
-  fighter * fi = co->magician.fig;
-  int level = co->level;
-  double power = co->force;
-  const spell * sp = co->sp;
-  battle *b = fi->side->battle;
-  message *m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp);
+    fighter * fi = co->magician.fig;
+    int level = co->level;
+    double power = co->force;
+    const spell * sp = co->sp;
+    battle *b = fi->side->battle;
+    message *m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp);
 
-  message_all(b, m);
-  msg_release(m);
+    message_all(b, m);
+    msg_release(m);
 
-  b->keeploot = (int)_max(25, b->keeploot + 5 * power);
+    b->keeploot = (int)_max(25, b->keeploot + 5 * power);
 
-  return level;
+    return level;
 }
 
 static int heal_fighters(quicklist * fgs, int *power, bool heal_monsters)
 {
-  int healhp = *power, healed = 0, qi;
-  quicklist *ql;
+    int healhp = *power, healed = 0, qi;
+    quicklist *ql;
 
-  for (qi = 0, ql = fgs; ql; ql_advance(&ql, &qi, 1)) {
-    fighter *df = (fighter *) ql_get(ql, qi);
+    for (qi = 0, ql = fgs; ql; ql_advance(&ql, &qi, 1)) {
+        fighter *df = (fighter *)ql_get(ql, qi);
 
-    if (healhp <= 0)
-      break;
-
-    /* Untote kann man nicht heilen */
-    if (df->unit->number == 0 || fval(u_race(df->unit), RCF_NOHEAL))
-      continue;
-
-    /* wir heilen erstmal keine Monster */
-    if (heal_monsters || playerrace(u_race(df->unit))) {
-      int n, hp = df->unit->hp / df->unit->number;
-      int rest = df->unit->hp % df->unit->number;
-
-      for (n = 0; n < df->unit->number; n++) {
-        int wound = hp - df->person[n].hp;
-        if (rest > n)
-          ++wound;
-
-        if (wound > 0 && wound < hp) {
-          int heal = _min(healhp, wound);
-          assert(heal >= 0);
-          df->person[n].hp += heal;
-          healhp = _max(0, healhp - heal);
-          ++healed;
-          if (healhp <= 0)
+        if (healhp <= 0)
             break;
-        }
-      }
-    }
-  }
 
-  *power = healhp;
-  return healed;
+        /* Untote kann man nicht heilen */
+        if (df->unit->number == 0 || fval(u_race(df->unit), RCF_NOHEAL))
+            continue;
+
+        /* wir heilen erstmal keine Monster */
+        if (heal_monsters || playerrace(u_race(df->unit))) {
+            int n, hp = df->unit->hp / df->unit->number;
+            int rest = df->unit->hp % df->unit->number;
+
+            for (n = 0; n < df->unit->number; n++) {
+                int wound = hp - df->person[n].hp;
+                if (rest > n)
+                    ++wound;
+
+                if (wound > 0 && wound < hp) {
+                    int heal = _min(healhp, wound);
+                    assert(heal >= 0);
+                    df->person[n].hp += heal;
+                    healhp = _max(0, healhp - heal);
+                    ++healed;
+                    if (healhp <= 0)
+                        break;
+                }
+            }
+        }
+    }
+
+    *power = healhp;
+    return healed;
 }
 
 int sp_healing(struct castorder * co)
 {
-  fighter * fi = co->magician.fig;
-  int level = co->level;
-  double power = co->force;
-  battle *b = fi->side->battle;
-  unit *mage = fi->unit;
-  int j = 0;
-  int healhp = (int)power * 200;
-  quicklist *fgs;
-  message *msg;
-  bool use_item = has_ao_healing(mage);
+    fighter * fi = co->magician.fig;
+    int level = co->level;
+    double power = co->force;
+    battle *b = fi->side->battle;
+    unit *mage = fi->unit;
+    int j = 0;
+    int healhp = (int)power * 200;
+    quicklist *fgs;
+    message *msg;
+    bool use_item = has_ao_healing(mage);
 
-  /* bis zu 11 Personen pro Stufe (einen HP m�ssen sie ja noch
-   * haben, sonst w�ren sie tot) k�nnen geheilt werden */
+    /* bis zu 11 Personen pro Stufe (einen HP m�ssen sie ja noch
+     * haben, sonst w�ren sie tot) k�nnen geheilt werden */
 
-  if (use_item) {
-    healhp *= 2;
-  }
+    if (use_item) {
+        healhp *= 2;
+    }
 
-  /* gehe alle denen wir helfen der reihe nach durch, heile verwundete,
-   * bis zu verteilende HP aufgebraucht sind */
+    /* gehe alle denen wir helfen der reihe nach durch, heile verwundete,
+     * bis zu verteilende HP aufgebraucht sind */
 
-  fgs = fighters(b, fi->side, FIGHT_ROW, AVOID_ROW, FS_HELP);
-  scramble_fighters(fgs);
-  j += heal_fighters(fgs, &healhp, false);
-  j += heal_fighters(fgs, &healhp, true);
-  ql_free(fgs);
+    fgs = fighters(b, fi->side, FIGHT_ROW, AVOID_ROW, FS_HELP);
+    scramble_fighters(fgs);
+    j += heal_fighters(fgs, &healhp, false);
+    j += heal_fighters(fgs, &healhp, true);
+    ql_free(fgs);
 
-  if (j <= 0) {
-    level = j;
-  }
-  if (use_item) {
-    msg =
-      msg_message("healing_effect_1", "mage amount item", mage, j,
-      get_resourcetype(R_AMULET_OF_HEALING));
-  } else {
-    msg = msg_message("healing_effect_0", "mage amount", mage, j);
-  }
-  message_all(b, msg);
-  msg_release(msg);
+    if (j <= 0) {
+        level = j;
+    }
+    if (use_item) {
+        msg =
+            msg_message("healing_effect_1", "mage amount item", mage, j,
+            get_resourcetype(R_AMULET_OF_HEALING));
+    }
+    else {
+        msg = msg_message("healing_effect_0", "mage amount", mage, j);
+    }
+    message_all(b, msg);
+    msg_release(msg);
 
-  return level;
+    return level;
 }
 
 int sp_undeadhero(struct castorder * co)
 {
-  fighter * fi = co->magician.fig;
-  int level = co->level;
-  double power = co->force;
-  battle *b = fi->side->battle;
-  unit *mage = fi->unit;
-  region *r = b->region;
-  quicklist *fgs, *ql;
-  int qi, n, undead = 0;
-  message *msg;
-  int force = (int)get_force(power, 0);
-  double c = 0.50 + 0.02 * power;
+    fighter * fi = co->magician.fig;
+    int level = co->level;
+    double power = co->force;
+    battle *b = fi->side->battle;
+    unit *mage = fi->unit;
+    region *r = b->region;
+    quicklist *fgs, *ql;
+    int qi, n, undead = 0;
+    message *msg;
+    int force = (int)get_force(power, 0);
+    double c = 0.50 + 0.02 * power;
 
-  /* Liste aus allen K�mpfern */
-  fgs = fighters(b, fi->side, FIGHT_ROW, AVOID_ROW, FS_ENEMY | FS_HELP);
-  scramble_fighters(fgs);
+    /* Liste aus allen K�mpfern */
+    fgs = fighters(b, fi->side, FIGHT_ROW, AVOID_ROW, FS_ENEMY | FS_HELP);
+    scramble_fighters(fgs);
 
-  for (qi = 0, ql = fgs; ql; ql_advance(&ql, &qi, 1)) {
-    fighter *df = (fighter *) ql_get(ql, qi);
-    unit *du = df->unit;
+    for (qi = 0, ql = fgs; ql; ql_advance(&ql, &qi, 1)) {
+        fighter *df = (fighter *)ql_get(ql, qi);
+        unit *du = df->unit;
 
-    if (force <= 0)
-      break;
-
-    /* keine Monster */
-    if (!playerrace(u_race(du)))
-      continue;
-
-    if (df->alive + df->run.number < du->number) {
-      int j = 0;
-
-      /* Wieviele Untote k�nnen wir aus dieser Einheit wecken? */
-      for (n = df->alive + df->run.number; n != du->number; n++) {
-        if (chance(c)) {
-          ++j;
-          if (--force <= 0)
+        if (force <= 0)
             break;
-        }
-      }
 
-      if (j > 0) {
-          item **ilist;
-        unit *u =
-            create_unit(r, mage->faction, 0, get_race(RC_UNDEAD), 0, du->name,
-          du);
+        /* keine Monster */
+        if (!playerrace(u_race(du)))
+            continue;
 
-        /* new units gets some stats from old unit */
+        if (df->alive + df->run.number < du->number) {
+            int j = 0;
 
-        if (du->display) {
-          unit_setinfo(u, du->display);
-        } else {
-          unit_setinfo(u, NULL);
-        }
-        setstatus(u, du->status);
-        setguard(u, GUARD_NONE);
-        for (ilist = &du->items; *ilist;) {
-            item *itm = *ilist;
-            int loot = itm->number * j / du->number;
-            if (loot != itm->number) {
-                int split = itm->number * j % du->number;
-                if (split > 0 && (rng_int() % du->number) < split) {
-                    ++loot;
+            /* Wieviele Untote k�nnen wir aus dieser Einheit wecken? */
+            for (n = df->alive + df->run.number; n != du->number; n++) {
+                if (chance(c)) {
+                    ++j;
+                    if (--force <= 0)
+                        break;
                 }
             }
-            i_change(&u->items, itm->type, loot);
-            i_change(ilist, itm->type, -loot);
-            if (*ilist == itm) {
-                ilist = &itm->next;
+
+            if (j > 0) {
+                item **ilist;
+                unit *u =
+                    create_unit(r, mage->faction, 0, get_race(RC_UNDEAD), 0, du->name,
+                    du);
+
+                /* new units gets some stats from old unit */
+
+                if (du->display) {
+                    unit_setinfo(u, du->display);
+                }
+                else {
+                    unit_setinfo(u, NULL);
+                }
+                setstatus(u, du->status);
+                setguard(u, GUARD_NONE);
+                for (ilist = &du->items; *ilist;) {
+                    item *itm = *ilist;
+                    int loot = itm->number * j / du->number;
+                    if (loot != itm->number) {
+                        int split = itm->number * j % du->number;
+                        if (split > 0 && (rng_int() % du->number) < split) {
+                            ++loot;
+                        }
+                    }
+                    i_change(&u->items, itm->type, loot);
+                    i_change(ilist, itm->type, -loot);
+                    if (*ilist == itm) {
+                        ilist = &itm->next;
+                    }
+                }
+
+                /* inherit stealth from magician */
+                if (fval(mage, UFL_ANON_FACTION)) {
+                    fset(u, UFL_ANON_FACTION);
+                }
+
+                /* transfer dead people to new unit, set hitpoints to those of old unit */
+                transfermen(du, u, j);
+                u->hp = u->number * unit_max_hp(du);
+                assert(j <= df->side->casualties);
+                df->side->casualties -= j;
+                df->side->dead -= j;
+
+                /* counting total number of undead */
+                undead += j;
             }
         }
-
-        /* inherit stealth from magician */
-        if (fval(mage, UFL_ANON_FACTION)) {
-          fset(u, UFL_ANON_FACTION);
-        }
-
-        /* transfer dead people to new unit, set hitpoints to those of old unit */
-        transfermen(du, u, j);
-        u->hp = u->number * unit_max_hp(du);
-        assert(j <= df->side->casualties);
-        df->side->casualties -= j;
-        df->side->dead -= j;
-
-        /* counting total number of undead */
-        undead += j;
-      }
     }
-  }
-  ql_free(fgs);
+    ql_free(fgs);
 
-  level = _min(level, undead);
-  if (undead == 0) {
-    msg =
-      msg_message("summonundead_effect_0", "mage region", mage, mage->region);
-  } else {
-    msg =
-      msg_message("summonundead_effect_1", "mage region amount", mage,
-      mage->region, undead);
-  }
+    level = _min(level, undead);
+    if (undead == 0) {
+        msg =
+            msg_message("summonundead_effect_0", "mage region", mage, mage->region);
+    }
+    else {
+        msg =
+            msg_message("summonundead_effect_1", "mage region amount", mage,
+            mage->region, undead);
+    }
 
-  message_all(b, msg);
-  msg_release(msg);
-  return level;
+    message_all(b, msg);
+    msg_release(msg);
+    return level;
 }
diff --git a/src/spells/combatspells.h b/src/spells/combatspells.h
index 9ff3e2e2b..2683c55e6 100644
--- a/src/spells/combatspells.h
+++ b/src/spells/combatspells.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -6,9 +6,9 @@
  |                   |  Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
  +-------------------+  Stefan Reich <reich@halbling.de>
 
- This program may not be used, modified or distributed 
+ This program may not be used, modified or distributed
  without prior permission by the authors of Eressea.
-*/
+ */
 
 #ifndef H_GC_COMBATSPELLS
 #define H_GC_COMBATSPELLS
@@ -17,39 +17,39 @@
 extern "C" {
 #endif
 
-  struct fighter;
+    struct fighter;
 
-  /* Kampfzauber */
-  extern int sp_fumbleshield(struct castorder * co);
-  extern int sp_shadowknights(struct castorder * co);
-  extern int sp_combatrosthauch(struct castorder * co);
-  extern int sp_kampfzauber(struct castorder * co);
-  extern int sp_healing(struct castorder * co);
-  extern int sp_keeploot(struct castorder * co);
-  extern int sp_reanimate(struct castorder * co);
-  extern int sp_chaosrow(struct castorder * co);
-  extern int sp_flee(struct castorder * co);
-  extern int sp_berserk(struct castorder * co);
-  extern int sp_tiredsoldiers(struct castorder * co);
-  extern int sp_reeling_arrows(struct castorder * co);
-  extern int sp_denyattack(struct castorder * co);
-  extern int sp_sleep(struct castorder * co);
-  extern int sp_windshield(struct castorder * co);
-  extern int sp_strong_wall(struct castorder * co);
-  extern int sp_petrify(struct castorder * co);
-  extern int sp_hero(struct castorder * co);
-  extern int sp_frighten(struct castorder * co);
-  extern int sp_mindblast(struct castorder * co);
-  extern int sp_mindblast_temp(struct castorder * co);
-  extern int sp_speed(struct castorder * co);
-  extern int sp_wolfhowl(struct castorder * co);
-  extern int sp_dragonodem(struct castorder * co);
-  extern int sp_reduceshield(struct castorder * co);
-  extern int sp_armorshield(struct castorder * co);
-  extern int sp_stun(struct castorder * co);
-  extern int sp_undeadhero(struct castorder * co);
-  extern int sp_shadowcall(struct castorder * co);
-  extern int sp_immolation(struct castorder * co);
+    /* Kampfzauber */
+    extern int sp_fumbleshield(struct castorder * co);
+    extern int sp_shadowknights(struct castorder * co);
+    extern int sp_combatrosthauch(struct castorder * co);
+    extern int sp_kampfzauber(struct castorder * co);
+    extern int sp_healing(struct castorder * co);
+    extern int sp_keeploot(struct castorder * co);
+    extern int sp_reanimate(struct castorder * co);
+    extern int sp_chaosrow(struct castorder * co);
+    extern int sp_flee(struct castorder * co);
+    extern int sp_berserk(struct castorder * co);
+    extern int sp_tiredsoldiers(struct castorder * co);
+    extern int sp_reeling_arrows(struct castorder * co);
+    extern int sp_denyattack(struct castorder * co);
+    extern int sp_sleep(struct castorder * co);
+    extern int sp_windshield(struct castorder * co);
+    extern int sp_strong_wall(struct castorder * co);
+    extern int sp_petrify(struct castorder * co);
+    extern int sp_hero(struct castorder * co);
+    extern int sp_frighten(struct castorder * co);
+    extern int sp_mindblast(struct castorder * co);
+    extern int sp_mindblast_temp(struct castorder * co);
+    extern int sp_speed(struct castorder * co);
+    extern int sp_wolfhowl(struct castorder * co);
+    extern int sp_dragonodem(struct castorder * co);
+    extern int sp_reduceshield(struct castorder * co);
+    extern int sp_armorshield(struct castorder * co);
+    extern int sp_stun(struct castorder * co);
+    extern int sp_undeadhero(struct castorder * co);
+    extern int sp_shadowcall(struct castorder * co);
+    extern int sp_immolation(struct castorder * co);
 
 #ifdef __cplusplus
 }
diff --git a/src/spells/regioncurse.c b/src/spells/regioncurse.c
index e0c6d8bf7..382b13b86 100644
--- a/src/spells/regioncurse.c
+++ b/src/spells/regioncurse.c
@@ -1,6 +1,6 @@
-/* vi: set ts=2:
+/*
  *
- * Eressea PB(E)M host Copyright (C) 1998-2003
+ * Eressea PB(E)M host Copyright (C) 1998-2015
  *      Christian Schlittchen (corwin@amber.kn-bremen.de)
  *      Katja Zedel (katze@felidae.kn-bremen.de)
  *      Henning Peters (faroul@beyond.kn-bremen.de)
@@ -35,30 +35,30 @@
 #include <assert.h>
 
 /* --------------------------------------------------------------------- */
-/* CurseInfo mit Spezialabfragen 
+/* CurseInfo mit Spezialabfragen
  */
 
 /*
  * godcursezone
  */
 static message *cinfo_cursed_by_the_gods(const void *obj, objtype_t typ,
-  const curse * c, int self)
+    const curse * c, int self)
 {
-  region *r = (region *) obj;
+    region *r = (region *)obj;
 
-  unused_arg(typ);
-  unused_arg(self);
-  assert(typ == TYP_REGION);
+    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);
+    if (fval(r->terrain, SEA_REGION)) {
+        return msg_message("curseinfo::godcurseocean", "id", c->no);
+    }
+    return msg_message("curseinfo::godcurse", "id", c->no);
 }
 
 static struct curse_type ct_godcursezone = {
-  "godcursezone",
-  CURSETYP_NORM, CURSE_IMMUNE | CURSE_ISNEW, (NO_MERGE),
+    "godcursezone",
+    CURSETYP_NORM, CURSE_IMMUNE | CURSE_ISNEW, (NO_MERGE),
     cinfo_cursed_by_the_gods,
 };
 
@@ -67,23 +67,24 @@ static struct curse_type ct_godcursezone = {
  * C_GBDREAM
  */
 static message *cinfo_dreamcurse(const void *obj, objtype_t typ, const curse * c,
-  int self)
+    int self)
 {
-  unused_arg(self);
-  unused_arg(typ);
-  unused_arg(obj);
-  assert(typ == TYP_REGION);
+    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);
-  }
+    if (c->effect > 0) {
+        return msg_message("curseinfo::gooddream", "id", c->no);
+    }
+    else {
+        return msg_message("curseinfo::baddream", "id", c->no);
+    }
 }
 
 static struct curse_type ct_gbdream = {
-  "gbdream",
-  CURSETYP_NORM, CURSE_ISNEW, (NO_MERGE), cinfo_dreamcurse
+    "gbdream",
+    CURSETYP_NORM, CURSE_ISNEW, (NO_MERGE), cinfo_dreamcurse
 };
 
 /* --------------------------------------------------------------------- */
@@ -92,213 +93,213 @@ static struct curse_type ct_gbdream = {
  *  erzeugt Stra�ennetz
  */
 static message *cinfo_magicstreet(const void *obj, objtype_t typ, const curse * c,
-  int self)
+    int self)
 {
-  unused_arg(typ);
-  unused_arg(self);
-  unused_arg(obj);
-  assert(typ == TYP_REGION);
+    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);
+    /* Warnung vor Aufl�sung */
+    if (c->duration >= 2) {
+        return msg_message("curseinfo::magicstreet", "id", c->no);
+    }
+    return msg_message("curseinfo::magicstreetwarn", "id", c->no);
 }
 
 static struct curse_type ct_magicstreet = {
-  "magicstreet",
-  CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR),
-  cinfo_magicstreet
+    "magicstreet",
+    CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR),
+    cinfo_magicstreet
 };
 
 /* --------------------------------------------------------------------- */
 
 static message *cinfo_antimagiczone(const void *obj, objtype_t typ, const curse * c,
-  int self)
+    int self)
 {
-  unused_arg(typ);
-  unused_arg(self);
-  unused_arg(obj);
-  assert(typ == TYP_REGION);
+    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);
-  }
+    /* Magier sp�ren eine Antimagiezone */
+    if (self != 0) {
+        return msg_message("curseinfo::antimagiczone", "id", c->no);
+    }
 
-  return NULL;
+    return NULL;
 }
 
 /* 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)
+const curse * c, int self)
 {
-  region *r;
-  unit *u = NULL;
-  unit *mage = c->magician;
+    region *r;
+    unit *u = NULL;
+    unit *mage = c->magician;
 
-  unused_arg(typ);
+    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;
-      }
+    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;
+    return self;
 }
 
 static struct curse_type ct_antimagiczone = {
-  "antimagiczone",
-  CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR),
-  cinfo_antimagiczone, NULL, NULL, NULL, cansee_antimagiczone
+    "antimagiczone",
+    CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR),
+    cinfo_antimagiczone, NULL, NULL, NULL, cansee_antimagiczone
 };
 
 /* --------------------------------------------------------------------- */
 static message *cinfo_farvision(const void *obj, objtype_t typ, const curse * c,
-  int self)
+    int self)
 {
-  unused_arg(typ);
-  unused_arg(obj);
+    unused_arg(typ);
+    unused_arg(obj);
 
-  assert(typ == TYP_REGION);
+    assert(typ == TYP_REGION);
 
-  /* Magier sp�ren eine farvision */
-  if (self != 0) {
-    return msg_message("curseinfo::farvision", "id", c->no);
-  }
+    /* Magier sp�ren eine farvision */
+    if (self != 0) {
+        return msg_message("curseinfo::farvision", "id", c->no);
+    }
 
-  return 0;
+    return 0;
 }
 
 static struct curse_type ct_farvision = {
-  "farvision",
-  CURSETYP_NORM, 0, (NO_MERGE),
-  cinfo_farvision
+    "farvision",
+    CURSETYP_NORM, 0, (NO_MERGE),
+    cinfo_farvision
 };
 
 /* --------------------------------------------------------------------- */
 
 static struct curse_type ct_fogtrap = {
-  "fogtrap",
-  CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR),
-  cinfo_simple
+    "fogtrap",
+    CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR),
+    cinfo_simple
 };
 
 static struct curse_type ct_maelstrom = {
-  "maelstrom",
-  CURSETYP_NORM, CURSE_ISNEW, (M_DURATION | M_VIGOUR),
-  cinfo_simple
+    "maelstrom",
+    CURSETYP_NORM, CURSE_ISNEW, (M_DURATION | M_VIGOUR),
+    cinfo_simple
 };
 
 static struct curse_type ct_blessedharvest = {
-  "blessedharvest",
-  CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR),
-  cinfo_simple
+    "blessedharvest",
+    CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR),
+    cinfo_simple
 };
 
 static struct curse_type ct_drought = {
-  "drought",
-  CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR),
-  cinfo_simple
+    "drought",
+    CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR),
+    cinfo_simple
 };
 
 static struct curse_type ct_badlearn = {
-  "badlearn",
-  CURSETYP_NORM, CURSE_ISNEW, (M_DURATION | M_VIGOUR),
-  cinfo_simple
+    "badlearn",
+    CURSETYP_NORM, CURSE_ISNEW, (M_DURATION | M_VIGOUR),
+    cinfo_simple
 };
 
 /*  Tr�bsal-Zauber */
 static struct curse_type ct_depression = {
-  "depression",
-  CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR),
-  cinfo_simple
+    "depression",
+    CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR),
+    cinfo_simple
 };
 
 /* Astralblock, auf Astralregion */
 static struct curse_type ct_astralblock = {
-  "astralblock",
-  CURSETYP_NORM, 0, NO_MERGE,
-  cinfo_simple
+    "astralblock",
+    CURSETYP_NORM, 0, NO_MERGE,
+    cinfo_simple
 };
 
 /* Unterhaltungsanteil vermehren */
 static struct curse_type ct_generous = {
-  "generous",
-  CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR | M_MAXEFFECT),
-  cinfo_simple
+    "generous",
+    CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR | M_MAXEFFECT),
+    cinfo_simple
 };
 
 /* verhindert Attackiere regional */
 static struct curse_type ct_peacezone = {
-  "peacezone",
-  CURSETYP_NORM, 0, NO_MERGE,
-  cinfo_simple
+    "peacezone",
+    CURSETYP_NORM, 0, NO_MERGE,
+    cinfo_simple
 };
 
 /*  erniedigt Magieresistenz von nicht-aliierten Einheiten, wirkt nur 1x
 *  pro Einheit */
 static struct curse_type ct_badmagicresistancezone = {
-  "badmagicresistancezone",
-  CURSETYP_NORM, 0, NO_MERGE,
-  cinfo_simple
+    "badmagicresistancezone",
+    CURSETYP_NORM, 0, NO_MERGE,
+    cinfo_simple
 };
 
 /* erh�ht Magieresistenz von aliierten Einheiten, wirkt nur 1x pro
 * Einheit */
 static struct curse_type ct_goodmagicresistancezone = {
-  "goodmagicresistancezone",
-  CURSETYP_NORM, 0, NO_MERGE,
-  cinfo_simple
+    "goodmagicresistancezone",
+    CURSETYP_NORM, 0, NO_MERGE,
+    cinfo_simple
 };
 
 static struct curse_type ct_riotzone = {
-  "riotzone",
-  CURSETYP_NORM, 0, (M_DURATION),
-  cinfo_simple
+    "riotzone",
+    CURSETYP_NORM, 0, (M_DURATION),
+    cinfo_simple
 };
 
 static struct curse_type ct_holyground = {
-  "holyground",
-  CURSETYP_NORM, CURSE_NOAGE, (M_VIGOUR_ADD),
-  cinfo_simple
+    "holyground",
+    CURSETYP_NORM, CURSE_NOAGE, (M_VIGOUR_ADD),
+    cinfo_simple
 };
 
 static struct curse_type ct_healing = {
-  "healingzone",
-  CURSETYP_NORM, 0, (M_VIGOUR | M_DURATION),
-  cinfo_simple
+    "healingzone",
+    CURSETYP_NORM, 0, (M_VIGOUR | M_DURATION),
+    cinfo_simple
 };
 
 void register_regioncurse(void)
 {
-  ct_register(&ct_fogtrap);
-  ct_register(&ct_antimagiczone);
-  ct_register(&ct_farvision);
-  ct_register(&ct_gbdream);
-  ct_register(&ct_maelstrom);
-  ct_register(&ct_blessedharvest);
-  ct_register(&ct_drought);
-  ct_register(&ct_badlearn);
-  ct_register(&ct_depression);
-  ct_register(&ct_astralblock);
-  ct_register(&ct_generous);
-  ct_register(&ct_peacezone);
-  ct_register(&ct_magicstreet);
-  ct_register(&ct_badmagicresistancezone);
-  ct_register(&ct_goodmagicresistancezone);
-  ct_register(&ct_riotzone);
-  ct_register(&ct_godcursezone);
-  ct_register(&ct_holyground);
-  ct_register(&ct_healing);
+    ct_register(&ct_fogtrap);
+    ct_register(&ct_antimagiczone);
+    ct_register(&ct_farvision);
+    ct_register(&ct_gbdream);
+    ct_register(&ct_maelstrom);
+    ct_register(&ct_blessedharvest);
+    ct_register(&ct_drought);
+    ct_register(&ct_badlearn);
+    ct_register(&ct_depression);
+    ct_register(&ct_astralblock);
+    ct_register(&ct_generous);
+    ct_register(&ct_peacezone);
+    ct_register(&ct_magicstreet);
+    ct_register(&ct_badmagicresistancezone);
+    ct_register(&ct_goodmagicresistancezone);
+    ct_register(&ct_riotzone);
+    ct_register(&ct_godcursezone);
+    ct_register(&ct_holyground);
+    ct_register(&ct_healing);
 }
diff --git a/src/spells/regioncurse.h b/src/spells/regioncurse.h
index 5e4afec5d..c261ade41 100644
--- a/src/spells/regioncurse.h
+++ b/src/spells/regioncurse.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  *
  * Eressea PB(E)M host Copyright (C) 1998-2003
  *      Christian Schlittchen (corwin@amber.kn-bremen.de)
@@ -17,10 +17,10 @@
 extern "C" {
 #endif
 
-  struct curse;
-  struct locale;
+    struct curse;
+    struct locale;
 
-  extern void register_regioncurse(void);
+    extern void register_regioncurse(void);
 
 #ifdef __cplusplus
 }
diff --git a/src/spells/shipcurse.c b/src/spells/shipcurse.c
index 71906821f..e79990fd6 100644
--- a/src/spells/shipcurse.c
+++ b/src/spells/shipcurse.c
@@ -1,6 +1,6 @@
-/* vi: set ts=2:
+/*
  *
- * Eressea PB(E)M host Copyright (C) 1998-2003
+ * Eressea PB(E)M host Copyright (C) 1998-2015
  *      Christian Schlittchen (corwin@amber.kn-bremen.de)
  *      Katja Zedel (katze@felidae.kn-bremen.de)
  *      Henning Peters (faroul@beyond.kn-bremen.de)
@@ -38,124 +38,127 @@
 
 message *cinfo_ship(const void *obj, objtype_t typ, const curse * c, int self)
 {
-  message *msg;
+    message *msg;
 
-  unused_arg(typ);
-  unused_arg(obj);
-  assert(typ == TYP_SHIP);
+    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;
+    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;
 }
 
 /* CurseInfo mit Spezialabfragen */
 
 /* C_SHIP_NODRIFT */
 static message *cinfo_shipnodrift(const void *obj, objtype_t typ, const curse * c,
-  int self)
+    int self)
 {
-  ship *sh = (ship *) obj;
+    ship *sh = (ship *)obj;
 
-  unused_arg(typ);
-  assert(typ == TYP_SHIP);
+    unused_arg(typ);
+    assert(typ == TYP_SHIP);
 
-  if (self != 0) {
-    return msg_message("curseinfo::shipnodrift_1", "ship duration id", sh,
-      c->duration, c->no);
-  }
-  return msg_message("curseinfo::shipnodrift_0", "ship id", sh, c->no);
+    if (self != 0) {
+        return msg_message("curseinfo::shipnodrift_1", "ship duration id", sh,
+            c->duration, c->no);
+    }
+    return msg_message("curseinfo::shipnodrift_0", "ship id", sh, c->no);
 }
 
 static struct curse_type ct_stormwind = { "stormwind",
-  CURSETYP_NORM, 0, NO_MERGE, cinfo_ship
+CURSETYP_NORM, 0, NO_MERGE, cinfo_ship
 };
 
 static int flyingship_read(storage * store, curse * c, void *target)
 {
-  ship *sh = (ship *) target;
-  c->data.v = sh;
-  if (global.data_version < FOSS_VERSION) {
-    sh->flags |= SF_FLYING;
+    ship *sh = (ship *)target;
+    c->data.v = sh;
+    if (global.data_version < FOSS_VERSION) {
+        sh->flags |= SF_FLYING;
+        return 0;
+    }
+    assert(sh->flags & SF_FLYING);
     return 0;
-  }
-  assert(sh->flags & SF_FLYING);
-  return 0;
 }
 
 static int flyingship_write(storage * store, const curse * c,
-  const void *target)
+    const void *target)
 {
-  const ship *sh = (const ship *)target;
-  assert(sh->flags & SF_FLYING);
-  return 0;
+    const ship *sh = (const ship *)target;
+    assert(sh->flags & SF_FLYING);
+    return 0;
 }
 
 static int flyingship_age(curse * c)
 {
-  ship *sh = (ship *) c->data.v;
-  if (sh && c->duration == 1) {
-    freset(sh, SF_FLYING);
-    return 1;
-  }
-  return 0;
+    ship *sh = (ship *)c->data.v;
+    if (sh && c->duration == 1) {
+        freset(sh, SF_FLYING);
+        return 1;
+    }
+    return 0;
 }
 
 static struct curse_type ct_flyingship = { "flyingship",
-  CURSETYP_NORM, 0, NO_MERGE, cinfo_ship, NULL, flyingship_read,
-    flyingship_write, NULL, flyingship_age
+CURSETYP_NORM, 0, NO_MERGE, cinfo_ship, NULL, flyingship_read,
+flyingship_write, NULL, flyingship_age
 };
 
 static struct curse_type ct_nodrift = { "nodrift",
-  CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR), cinfo_shipnodrift
+CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR), cinfo_shipnodrift
 };
 
 static struct curse_type ct_shipspeedup = { "shipspeedup",
-  CURSETYP_NORM, 0, 0, cinfo_ship
+CURSETYP_NORM, 0, 0, cinfo_ship
 };
 
 curse *shipcurse_flyingship(ship * sh, unit * mage, float power, int duration)
 {
-  static const curse_type *ct_flyingship = NULL;
-  if (!ct_flyingship) {
-    ct_flyingship = ct_find("flyingship");
-    assert(ct_flyingship);
-  }
-  if (curse_active(get_curse(sh->attribs, ct_flyingship))) {
-    return NULL;
-  } else if (is_cursed(sh->attribs, C_SHIP_SPEEDUP, 0)) {
-    return NULL;
-  } else {
-    /* mit C_SHIP_NODRIFT haben wir kein Problem */
-    curse *c =
-      create_curse(mage, &sh->attribs, ct_flyingship, power, duration, 0.0, 0);
-    c->data.v = sh;
-    if (c && c->duration > 0) {
-      sh->flags |= SF_FLYING;
+    static const curse_type *ct_flyingship = NULL;
+    if (!ct_flyingship) {
+        ct_flyingship = ct_find("flyingship");
+        assert(ct_flyingship);
+    }
+    if (curse_active(get_curse(sh->attribs, ct_flyingship))) {
+        return NULL;
+    }
+    else if (is_cursed(sh->attribs, C_SHIP_SPEEDUP, 0)) {
+        return NULL;
+    }
+    else {
+        /* mit C_SHIP_NODRIFT haben wir kein Problem */
+        curse *c =
+            create_curse(mage, &sh->attribs, ct_flyingship, power, duration, 0.0, 0);
+        c->data.v = sh;
+        if (c && c->duration > 0) {
+            sh->flags |= SF_FLYING;
+        }
+        return c;
     }
-    return c;
-  }
 }
 
 int levitate_ship(ship * sh, unit * mage, float power, int duration)
 {
-  curse *c = shipcurse_flyingship(sh, mage, power, duration);
-  if (c) {
-    return c->no;
-  }
-  return 0;
+    curse *c = shipcurse_flyingship(sh, mage, power, duration);
+    if (c) {
+        return c->no;
+    }
+    return 0;
 }
 
 void register_shipcurse(void)
 {
-  ct_register(&ct_stormwind);
-  ct_register(&ct_flyingship);
-  ct_register(&ct_nodrift);
-  ct_register(&ct_shipspeedup);
+    ct_register(&ct_stormwind);
+    ct_register(&ct_flyingship);
+    ct_register(&ct_nodrift);
+    ct_register(&ct_shipspeedup);
 }
diff --git a/src/spells/shipcurse.h b/src/spells/shipcurse.h
index 551d1a920..b64b3fd79 100644
--- a/src/spells/shipcurse.h
+++ b/src/spells/shipcurse.h
@@ -1,6 +1,5 @@
-/* vi: set ts=2:
- *
- * Eressea PB(E)M host Copyright (C) 1998-2003
+/*
+ * Eressea PB(E)M host Copyright (C) 1998-2015
  *      Christian Schlittchen (corwin@amber.kn-bremen.de)
  *      Katja Zedel (katze@felidae.kn-bremen.de)
  *      Henning Peters (faroul@beyond.kn-bremen.de)
@@ -27,12 +26,12 @@ extern "C" {
     struct curse;
 
     struct message *cinfo_ship(const void *obj, objtype_t typ,
-                               const struct curse *c, int self);
+        const struct curse *c, int self);
     void register_shipcurse(void);
     struct curse *shipcurse_flyingship(struct ship *sh, struct unit *mage,
-                                       float power, int duration);
+        float power, int duration);
     int levitate_ship(struct ship *sh, struct unit *mage, float power,
-                      int duration);
+        int duration);
 
 #ifdef __cplusplus
 }
diff --git a/src/spells/unitcurse.c b/src/spells/unitcurse.c
index 39a7d0ff2..bd332ebf5 100644
--- a/src/spells/unitcurse.c
+++ b/src/spells/unitcurse.c
@@ -1,6 +1,6 @@
-/* vi: set ts=2:
+/* 
  *
- * Eressea PB(E)M host Copyright (C) 1998-2003
+ * Eressea PB(E)M host Copyright (C) 1998-2015
  *      Christian Schlittchen (corwin@amber.kn-bremen.de)
  *      Katja Zedel (katze@felidae.kn-bremen.de)
  *      Henning Peters (faroul@beyond.kn-bremen.de)
diff --git a/src/spells/unitcurse.h b/src/spells/unitcurse.h
index b74146d9a..15d535cab 100644
--- a/src/spells/unitcurse.h
+++ b/src/spells/unitcurse.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  *
  * Eressea PB(E)M host Copyright (C) 1998-2003
  *      Christian Schlittchen (corwin@amber.kn-bremen.de)
@@ -19,12 +19,12 @@
 extern "C" {
 #endif
 
-  struct curse;
-  struct message;
-  extern struct message *cinfo_unit(const void *obj, objtype_t typ,
-    const struct curse *c, int self);
+    struct curse;
+    struct message;
+    extern struct message *cinfo_unit(const void *obj, objtype_t typ,
+        const struct curse *c, int self);
 
-  extern void register_unitcurse(void);
+    extern void register_unitcurse(void);
 
 #ifdef __cplusplus
 }
diff --git a/src/spy.c b/src/spy.c
index 5531eb684..79cefcd76 100644
--- a/src/spy.c
+++ b/src/spy.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/spy.h b/src/spy.h
index 7f6eded75..50937981b 100644
--- a/src/spy.h
+++ b/src/spy.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,15 +22,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  struct unit;
-  struct region;
-  struct strlist;
+    struct unit;
+    struct region;
+    struct strlist;
 
-  extern int setstealth_cmd(struct unit *u, struct order *ord);
-  extern int spy_cmd(struct unit *u, struct order *ord);
-  extern int sabotage_cmd(struct unit *u, struct order *ord);
-  extern void spy_message(int spy, const struct unit *u,
-    const struct unit *target);
+    extern int setstealth_cmd(struct unit *u, struct order *ord);
+    extern int spy_cmd(struct unit *u, struct order *ord);
+    extern int sabotage_cmd(struct unit *u, struct order *ord);
+    extern void spy_message(int spy, const struct unit *u,
+        const struct unit *target);
 
 #define OCEAN_SWIMMER_CHANCE 0.1
 #define CANAL_SWIMMER_CHANCE 0.9
diff --git a/src/sqlite.c b/src/sqlite.c
index 4e7a8ec2e..c19aa6903 100644
--- a/src/sqlite.c
+++ b/src/sqlite.c
@@ -16,21 +16,21 @@
 
 faction *get_faction_by_id(int uid)
 {
-  faction *f;
-  for (f = factions; f; f = f->next) {
-    if (f->subscription == uid) {
-      return f;
+    faction *f;
+    for (f = factions; f; f = f->next) {
+        if (f->subscription == uid) {
+            return f;
+        }
     }
-  }
-  return NULL;
+    return NULL;
 }
 
 /*
 typedef struct stmt_cache {
-  sqlite3 *db;
-  sqlite3_stmt *stmt;
-  const char *sql;
-  int inuse;
+sqlite3 *db;
+sqlite3_stmt *stmt;
+const char *sql;
+int inuse;
 } stmt_cache;
 
 #define MAX_STMT_CACHE 64
@@ -39,167 +39,168 @@ static int cache_insert;
 
 static sqlite3_stmt *stmt_cache_get(sqlite3 * db, const char *sql)
 {
-  int i;
-  sqlite3_stmt *stmt;
+int i;
+sqlite3_stmt *stmt;
 
-  for (i = 0; i != MAX_STMT_CACHE && cache[i].db; ++i) {
-    if (cache[i].sql == sql && cache[i].db == db) {
-      cache[i].inuse = 1;
-      stmt = cache[i].stmt;
-      sqlite3_reset(stmt);
-      sqlite3_clear_bindings(stmt);
-      return stmt;
-    }
-  }
-  if (i == MAX_STMT_CACHE) {
-    while (cache[cache_insert].inuse) {
-      cache[cache_insert].inuse = 0;
-      cache_insert = (cache_insert + 1) & (MAX_STMT_CACHE - 1);
-    }
-    i = cache_insert;
-    stmt = cache[i].stmt;
-    sqlite3_finalize(stmt);
-  }
-  cache[i].inuse = 1;
-  cache[i].db = db;
-  cache[i].sql = sql;
-  sqlite3_prepare_v2(db, sql, -1, &cache[i].stmt, NULL);
-  return cache[i].stmt;
+for (i = 0; i != MAX_STMT_CACHE && cache[i].db; ++i) {
+if (cache[i].sql == sql && cache[i].db == db) {
+cache[i].inuse = 1;
+stmt = cache[i].stmt;
+sqlite3_reset(stmt);
+sqlite3_clear_bindings(stmt);
+return stmt;
+}
+}
+if (i == MAX_STMT_CACHE) {
+while (cache[cache_insert].inuse) {
+cache[cache_insert].inuse = 0;
+cache_insert = (cache_insert + 1) & (MAX_STMT_CACHE - 1);
+}
+i = cache_insert;
+stmt = cache[i].stmt;
+sqlite3_finalize(stmt);
+}
+cache[i].inuse = 1;
+cache[i].db = db;
+cache[i].sql = sql;
+sqlite3_prepare_v2(db, sql, -1, &cache[i].stmt, NULL);
+return cache[i].stmt;
 }
 */
 typedef struct db_faction {
-  int uid;
-  int no;
-  char *email;
-  char *name;
+    int uid;
+    int no;
+    char *email;
+    char *name;
 } db_faction;
 
 static struct quicklist *
 read_factions(sqlite3 * db, int game_id) {
-  int res;
-  quicklist *result = 0;
-  const char * sql =
-    "SELECT f.id, fd.code, fd.name, fd.email FROM faction f"
-    " LEFT OUTER JOIN faction_data fd"
-    " WHERE f.id=fd.faction_id AND f.game_id=? AND"
-    " fd.turn=(SELECT MAX(turn) FROM faction_data fx WHERE fx.faction_id=f.id)"
-    " ORDER BY f.id";
-  sqlite3_stmt *stmt = 0;
-  sqlite3_prepare_v2(db, sql, -1, &stmt, 0);
-  sqlite3_bind_int(stmt, 1, game_id);
+    int res;
+    quicklist *result = 0;
+    const char * sql =
+        "SELECT f.id, fd.code, fd.name, fd.email FROM faction f"
+        " LEFT OUTER JOIN faction_data fd"
+        " WHERE f.id=fd.faction_id AND f.game_id=? AND"
+        " fd.turn=(SELECT MAX(turn) FROM faction_data fx WHERE fx.faction_id=f.id)"
+        " ORDER BY f.id";
+    sqlite3_stmt *stmt = 0;
+    sqlite3_prepare_v2(db, sql, -1, &stmt, 0);
+    sqlite3_bind_int(stmt, 1, game_id);
 
-  res = sqlite3_step(stmt);
-  while (res == SQLITE_ROW) {
-    const char * text;
-    db_faction * dbf = (db_faction*)calloc(1, sizeof(db_faction));
-    dbf->uid = (int)sqlite3_column_int64(stmt, 0);
-    text = (const char *)sqlite3_column_text(stmt, 1);
-    if (text) dbf->no = atoi36(text);
-    text = (const char *)sqlite3_column_text(stmt, 2);
-    if (text) dbf->name = _strdup(text);
-    text = (const char *)sqlite3_column_text(stmt, 3);
-    if (text) dbf->email = _strdup(text);
-    ql_push(&result, dbf);
     res = sqlite3_step(stmt);
-  }
-  sqlite3_finalize(stmt);
-  return result;
+    while (res == SQLITE_ROW) {
+        const char * text;
+        db_faction * dbf = (db_faction*)calloc(1, sizeof(db_faction));
+        dbf->uid = (int)sqlite3_column_int64(stmt, 0);
+        text = (const char *)sqlite3_column_text(stmt, 1);
+        if (text) dbf->no = atoi36(text);
+        text = (const char *)sqlite3_column_text(stmt, 2);
+        if (text) dbf->name = _strdup(text);
+        text = (const char *)sqlite3_column_text(stmt, 3);
+        if (text) dbf->email = _strdup(text);
+        ql_push(&result, dbf);
+        res = sqlite3_step(stmt);
+    }
+    sqlite3_finalize(stmt);
+    return result;
 }
 
 static int insert_faction(sqlite3 *db, int game_id, faction *f) {
-  const char *sql = "INSERT INTO faction (game_id, race) VALUES (?, ?)";
-  sqlite3_stmt *stmt = 0;
-  sqlite3_prepare_v2(db, sql, -1, &stmt, 0);
-  sqlite3_bind_int(stmt, 1, game_id);
-  sqlite3_bind_text(stmt, 2, f->race->_name, -1, SQLITE_STATIC);
-  sqlite3_step(stmt);
-  sqlite3_finalize(stmt);
-  return (int)sqlite3_last_insert_rowid(db);
+    const char *sql = "INSERT INTO faction (game_id, race) VALUES (?, ?)";
+    sqlite3_stmt *stmt = 0;
+    sqlite3_prepare_v2(db, sql, -1, &stmt, 0);
+    sqlite3_bind_int(stmt, 1, game_id);
+    sqlite3_bind_text(stmt, 2, f->race->_name, -1, SQLITE_STATIC);
+    sqlite3_step(stmt);
+    sqlite3_finalize(stmt);
+    return (int)sqlite3_last_insert_rowid(db);
 }
 
 static void update_faction(sqlite3 *db, const faction *f) {
-  char code[5];
-  const char *sql =
-    "INSERT INTO faction_data (faction_id, code, name, email, lang, turn)"
-    " VALUES (?, ?, ?, ?, ?, ?)";
-  sqlite3_stmt *stmt = 0;
-  sqlite3_prepare_v2(db, sql, -1, &stmt, 0);
-  sqlite3_bind_int(stmt, 1, f->subscription);
-  strcpy(code, itoa36(f->no));
-  sqlite3_bind_text(stmt, 2, code, -1, SQLITE_STATIC);
-  sqlite3_bind_text(stmt, 3, f->name, -1, SQLITE_STATIC);
-  sqlite3_bind_text(stmt, 4, f->email, -1, SQLITE_STATIC);
-  sqlite3_bind_text(stmt, 5, f->locale->name, -1, SQLITE_STATIC);
-  sqlite3_bind_int(stmt, 6, turn);
-  sqlite3_step(stmt);
-  sqlite3_finalize(stmt);
+    char code[5];
+    const char *sql =
+        "INSERT INTO faction_data (faction_id, code, name, email, lang, turn)"
+        " VALUES (?, ?, ?, ?, ?, ?)";
+    sqlite3_stmt *stmt = 0;
+    sqlite3_prepare_v2(db, sql, -1, &stmt, 0);
+    sqlite3_bind_int(stmt, 1, f->subscription);
+    strcpy(code, itoa36(f->no));
+    sqlite3_bind_text(stmt, 2, code, -1, SQLITE_STATIC);
+    sqlite3_bind_text(stmt, 3, f->name, -1, SQLITE_STATIC);
+    sqlite3_bind_text(stmt, 4, f->email, -1, SQLITE_STATIC);
+    sqlite3_bind_text(stmt, 5, f->locale->name, -1, SQLITE_STATIC);
+    sqlite3_bind_int(stmt, 6, turn);
+    sqlite3_step(stmt);
+    sqlite3_finalize(stmt);
 }
 
 int db_update_factions(sqlite3 * db, bool force, int game_id) {
-  quicklist *ql = read_factions(db, game_id);
-  faction *f;
-  sqlite3_exec(db, "BEGIN", 0, 0, 0);
-  for (f=factions;f;f=f->next) {
-    bool update = force;
-    db_faction *dbf = 0;
-    ql_iter it = qli_init(&ql);
-    while (qli_more(it)) {
-      db_faction *df = (db_faction*)qli_next(&it);
-      if (f->no==df->no || strcmp(f->email,df->email)==0 || strcmp(f->name,df->name)==0) {
-        dbf = df;
-      }
-      if (f->subscription==df->uid) {
-        dbf = df;
-        break;
-      }
+    quicklist *ql = read_factions(db, game_id);
+    faction *f;
+    sqlite3_exec(db, "BEGIN", 0, 0, 0);
+    for (f = factions; f; f = f->next) {
+        bool update = force;
+        db_faction *dbf = 0;
+        ql_iter it = qli_init(&ql);
+        while (qli_more(it)) {
+            db_faction *df = (db_faction*)qli_next(&it);
+            if (f->no == df->no || strcmp(f->email, df->email) == 0 || strcmp(f->name, df->name) == 0) {
+                dbf = df;
+            }
+            if (f->subscription == df->uid) {
+                dbf = df;
+                break;
+            }
+        }
+        if (dbf) {
+            if (dbf->uid != f->subscription) {
+                log_warning("faction %s(%d) not found in database, but matches %d\n", itoa36(f->no), f->subscription, dbf->uid);
+                f->subscription = dbf->uid;
+            }
+            update = (dbf->no != f->no) || (strcmp(f->email, dbf->email) != 0) || (strcmp(f->name, dbf->name) != 0);
+        }
+        else {
+            f->subscription = insert_faction(db, game_id, f);
+            log_warning("faction %s not found in database, created as %d\n", itoa36(f->no), f->subscription);
+            update = true;
+        }
+        if (update) {
+            update_faction(db, f);
+            log_debug("faction %s updated\n", itoa36(f->no));
+        }
     }
-    if (dbf) {
-      if (dbf->uid != f->subscription) {
-        log_warning("faction %s(%d) not found in database, but matches %d\n", itoa36(f->no), f->subscription, dbf->uid);
-        f->subscription = dbf->uid;
-      }
-      update = (dbf->no!=f->no) || (strcmp(f->email, dbf->email)!=0) || (strcmp(f->name, dbf->name)!=0);
-    } else {
-      f->subscription = insert_faction(db, game_id, f);
-      log_warning("faction %s not found in database, created as %d\n", itoa36(f->no), f->subscription);
-      update = true;
-    }
-    if (update) {
-      update_faction(db, f);
-      log_debug("faction %s updated\n", itoa36(f->no));
-    }
-  }
-  sqlite3_exec(db, "COMMIT", 0, 0, 0);
-  return SQLITE_OK;
+    sqlite3_exec(db, "COMMIT", 0, 0, 0);
+    return SQLITE_OK;
 }
 
 int db_update_scores(sqlite3 * db, bool force)
 {
-  /*
-  const char *sql_ins =
+    /*
+    const char *sql_ins =
     "INSERT OR FAIL INTO score (value,faction_id,turn) VALUES (?,?,?)";
-  sqlite3_stmt *stmt_ins = stmt_cache_get(db, sql_ins);
-  const char *sql_upd =
+    sqlite3_stmt *stmt_ins = stmt_cache_get(db, sql_ins);
+    const char *sql_upd =
     "UPDATE score set value=? WHERE faction_id=? AND turn=?";
-  sqlite3_stmt *stmt_upd = stmt_cache_get(db, sql_upd);
-  faction *f;
-  sqlite3_exec(db, "BEGIN", 0, 0, 0);
-  for (f = factions; f; f = f->next) {
+    sqlite3_stmt *stmt_upd = stmt_cache_get(db, sql_upd);
+    faction *f;
+    sqlite3_exec(db, "BEGIN", 0, 0, 0);
+    for (f = factions; f; f = f->next) {
     int res;
     sqlite3_bind_int(stmt_ins, 1, f->score);
     sqlite3_bind_int64(stmt_ins, 2, f->subscription);
     sqlite3_bind_int(stmt_ins, 3, turn);
     res = sqlite3_step(stmt_ins);
     if (res == SQLITE_CONSTRAINT) {
-      sqlite3_bind_int(stmt_upd, 1, f->score);
-      sqlite3_bind_int64(stmt_upd, 2, f->subscription);
-      sqlite3_bind_int(stmt_upd, 3, turn);
-      res = sqlite3_step(stmt_upd);
-      sqlite3_reset(stmt_upd);
+    sqlite3_bind_int(stmt_upd, 1, f->score);
+    sqlite3_bind_int64(stmt_upd, 2, f->subscription);
+    sqlite3_bind_int(stmt_upd, 3, turn);
+    res = sqlite3_step(stmt_upd);
+    sqlite3_reset(stmt_upd);
     }
     sqlite3_reset(stmt_ins);
-  }
-  sqlite3_exec(db, "COMMIT", 0, 0, 0);
-  */
-  return SQLITE_OK;
+    }
+    sqlite3_exec(db, "COMMIT", 0, 0, 0);
+    */
+    return SQLITE_OK;
 }
diff --git a/src/study.c b/src/study.c
index 04f9b9a30..8382431c5 100644
--- a/src/study.c
+++ b/src/study.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
@@ -607,211 +607,211 @@ int learn_cmd(unit * u, order * ord)
       }
   }
 
-    if (sk == SK_MAGIC) {
-        if (u->number > 1) {
-            cmistake(u, ord, 106, MSG_MAGIC);
-            return 0;
-        }
-        if (is_familiar(u)) {
-            /* Vertraute zaehlen nicht zu den Magiern einer Partei,
-             * koennen aber nur Graue Magie lernen */
-            mtyp = M_GRAY;
-            if (!is_mage(u))
-                create_mage(u, mtyp);
-        }
-        else if (!has_skill(u, SK_MAGIC)) {
-            int mmax = skill_limit(u->faction, SK_MAGIC);
-            /* Die Einheit ist noch kein Magier */
-            if (count_skill(u->faction, SK_MAGIC) + u->number > mmax) {
-                ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "error_max_magicians",
-                    "amount", mmax));
-                return 0;
-            }
-            mtyp = getmagicskill(u->faction->locale);
-            if (mtyp == M_NONE || mtyp == M_GRAY) {
-                /* wurde kein Magiegebiet angegeben, wird davon
-                 * ausgegangen, dass das normal gelernt werden soll */
-                if (u->faction->magiegebiet != 0) {
-                    mtyp = u->faction->magiegebiet;
-                }
-                else {
-                    /* Es wurde kein Magiegebiet angegeben und die Partei
-                     * hat noch keins gewaehlt. */
-                    mtyp = getmagicskill(u->faction->locale);
-                    if (mtyp == M_NONE) {
-                        cmistake(u, ord, 178, MSG_MAGIC);
-                        return 0;
-                    }
-                }
-            }
-            if (mtyp != u->faction->magiegebiet) {
-                /* Es wurde versucht, ein anderes Magiegebiet zu lernen
-                 * als das der Partei */
-                if (u->faction->magiegebiet != 0) {
-                    cmistake(u, ord, 179, MSG_MAGIC);
-                    return 0;
-                }
-                else {
-                    /* Lernt zum ersten mal Magie und legt damit das
-                     * Magiegebiet der Partei fest */
-                    u->faction->magiegebiet = mtyp;
-                }
-            }
-            if (!is_mage(u))
-                create_mage(u, mtyp);
-        }
-        else {
-            /* ist schon ein Magier und kein Vertrauter */
-            if (u->faction->magiegebiet == 0) {
-                /* die Partei hat noch kein Magiegebiet gewaehlt. */
-                mtyp = getmagicskill(u->faction->locale);
-                if (mtyp == M_NONE) {
-                    mtyp = getmagicskill(u->faction->locale);
-                    if (mtyp == M_NONE) {
-                        cmistake(u, ord, 178, MSG_MAGIC);
-                        return 0;
-                    }
-                }
-                /* Legt damit das Magiegebiet der Partei fest */
-                u->faction->magiegebiet = mtyp;
-            }
-        }
-    }
-    if (sk == SK_ALCHEMY) {
-        maxalchemy = eff_skill(u, SK_ALCHEMY, r);
-        if (!has_skill(u, SK_ALCHEMY)) {
-            int amax = skill_limit(u->faction, SK_ALCHEMY);
-            if (count_skill(u->faction, SK_ALCHEMY) + u->number > amax) {
-                ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "error_max_alchemists",
-                    "amount", amax));
-                return 0;
-            }
-        }
-    }
-    if (studycost) {
-        int cost = studycost * u->number;
-        money = get_pooled(u, get_resourcetype(R_SILVER), GET_DEFAULT, cost);
-        money = _min(money, cost);
-    }
-    if (money < studycost * u->number) {
-        studycost = p;              /* Ohne Univertreurung */
-        money = _min(money, studycost);
-        if (p > 0 && money < studycost * u->number) {
-            cmistake(u, ord, 65, MSG_EVENT);
-            multi = money / (double)(studycost * u->number);
-        }
-    }
+  if (sk == SK_MAGIC) {
+      if (u->number > 1) {
+          cmistake(u, ord, 106, MSG_MAGIC);
+          return 0;
+      }
+      if (is_familiar(u)) {
+          /* Vertraute zaehlen nicht zu den Magiern einer Partei,
+           * koennen aber nur Graue Magie lernen */
+          mtyp = M_GRAY;
+          if (!is_mage(u))
+              create_mage(u, mtyp);
+      }
+      else if (!has_skill(u, SK_MAGIC)) {
+          int mmax = skill_limit(u->faction, SK_MAGIC);
+          /* Die Einheit ist noch kein Magier */
+          if (count_skill(u->faction, SK_MAGIC) + u->number > mmax) {
+              ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "error_max_magicians",
+                  "amount", mmax));
+              return 0;
+          }
+          mtyp = getmagicskill(u->faction->locale);
+          if (mtyp == M_NONE || mtyp == M_GRAY) {
+              /* wurde kein Magiegebiet angegeben, wird davon
+               * ausgegangen, dass das normal gelernt werden soll */
+              if (u->faction->magiegebiet != 0) {
+                  mtyp = u->faction->magiegebiet;
+              }
+              else {
+                  /* Es wurde kein Magiegebiet angegeben und die Partei
+                   * hat noch keins gewaehlt. */
+                  mtyp = getmagicskill(u->faction->locale);
+                  if (mtyp == M_NONE) {
+                      cmistake(u, ord, 178, MSG_MAGIC);
+                      return 0;
+                  }
+              }
+          }
+          if (mtyp != u->faction->magiegebiet) {
+              /* Es wurde versucht, ein anderes Magiegebiet zu lernen
+               * als das der Partei */
+              if (u->faction->magiegebiet != 0) {
+                  cmistake(u, ord, 179, MSG_MAGIC);
+                  return 0;
+              }
+              else {
+                  /* Lernt zum ersten mal Magie und legt damit das
+                   * Magiegebiet der Partei fest */
+                  u->faction->magiegebiet = mtyp;
+              }
+          }
+          if (!is_mage(u))
+              create_mage(u, mtyp);
+      }
+      else {
+          /* ist schon ein Magier und kein Vertrauter */
+          if (u->faction->magiegebiet == 0) {
+              /* die Partei hat noch kein Magiegebiet gewaehlt. */
+              mtyp = getmagicskill(u->faction->locale);
+              if (mtyp == M_NONE) {
+                  mtyp = getmagicskill(u->faction->locale);
+                  if (mtyp == M_NONE) {
+                      cmistake(u, ord, 178, MSG_MAGIC);
+                      return 0;
+                  }
+              }
+              /* Legt damit das Magiegebiet der Partei fest */
+              u->faction->magiegebiet = mtyp;
+          }
+      }
+  }
+  if (sk == SK_ALCHEMY) {
+      maxalchemy = eff_skill(u, SK_ALCHEMY, r);
+      if (!has_skill(u, SK_ALCHEMY)) {
+          int amax = skill_limit(u->faction, SK_ALCHEMY);
+          if (count_skill(u->faction, SK_ALCHEMY) + u->number > amax) {
+              ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "error_max_alchemists",
+                  "amount", amax));
+              return 0;
+          }
+      }
+  }
+  if (studycost) {
+      int cost = studycost * u->number;
+      money = get_pooled(u, get_resourcetype(R_SILVER), GET_DEFAULT, cost);
+      money = _min(money, cost);
+  }
+  if (money < studycost * u->number) {
+      studycost = p;              /* Ohne Univertreurung */
+      money = _min(money, studycost);
+      if (p > 0 && money < studycost * u->number) {
+          cmistake(u, ord, 65, MSG_EVENT);
+          multi = money / (double)(studycost * u->number);
+      }
+  }
 
-    if (teach == NULL) {
-        a = a_add(&u->attribs, a_new(&at_learning));
-        teach = (teaching_info *)a->data.v;
-        teach->teachers[0] = 0;
-    }
-    if (money > 0) {
-        use_pooled(u, get_resourcetype(R_SILVER), GET_DEFAULT, money);
-        ADDMSG(&u->faction->msgs, msg_message("studycost",
-            "unit region cost skill", u, u->region, money, sk));
-    }
+  if (teach == NULL) {
+      a = a_add(&u->attribs, a_new(&at_learning));
+      teach = (teaching_info *)a->data.v;
+      teach->teachers[0] = 0;
+  }
+  if (money > 0) {
+      use_pooled(u, get_resourcetype(R_SILVER), GET_DEFAULT, money);
+      ADDMSG(&u->faction->msgs, msg_message("studycost",
+          "unit region cost skill", u, u->region, money, sk));
+  }
 
-    if (get_effect(u, oldpotiontype[P_WISE])) {
-        l = _min(u->number, get_effect(u, oldpotiontype[P_WISE]));
-        teach->value += l * 10;
-        change_effect(u, oldpotiontype[P_WISE], -l);
-    }
-    if (get_effect(u, oldpotiontype[P_FOOL])) {
-        l = _min(u->number, get_effect(u, oldpotiontype[P_FOOL]));
-        teach->value -= l * 30;
-        change_effect(u, oldpotiontype[P_FOOL], -l);
-    }
+  if (get_effect(u, oldpotiontype[P_WISE])) {
+      l = _min(u->number, get_effect(u, oldpotiontype[P_WISE]));
+      teach->value += l * 10;
+      change_effect(u, oldpotiontype[P_WISE], -l);
+  }
+  if (get_effect(u, oldpotiontype[P_FOOL])) {
+      l = _min(u->number, get_effect(u, oldpotiontype[P_FOOL]));
+      teach->value -= l * 30;
+      change_effect(u, oldpotiontype[P_FOOL], -l);
+  }
 
-    if (p != studycost) {
-        /* ist_in_gebaeude(r, u, BT_UNIVERSITAET) == 1) { */
-        /* p ist Kosten ohne Uni, studycost mit; wenn
-         * p!=studycost, ist die Einheit zwangsweise
-         * in einer Uni */
-        teach->value += u->number * 10;
-    }
+  if (p != studycost) {
+      /* ist_in_gebaeude(r, u, BT_UNIVERSITAET) == 1) { */
+      /* p ist Kosten ohne Uni, studycost mit; wenn
+       * p!=studycost, ist die Einheit zwangsweise
+       * in einer Uni */
+      teach->value += u->number * 10;
+  }
 
-    if (is_cursed(r->attribs, C_BADLEARN, 0)) {
-        teach->value -= u->number * 10;
-    }
+  if (is_cursed(r->attribs, C_BADLEARN, 0)) {
+      teach->value -= u->number * 10;
+  }
 
-    multi *= study_speedup(u, sk, speed_rule);
-    days = study_days(u, sk);
-    days = (int)((days + teach->value) * multi);
+  multi *= study_speedup(u, sk, speed_rule);
+  days = study_days(u, sk);
+  days = (int)((days + teach->value) * multi);
 
-    /* the artacademy currently improves the learning of entertainment
-       of all units in the region, to be able to make it cumulative with
-       with an academy */
+  /* the artacademy currently improves the learning of entertainment
+     of all units in the region, to be able to make it cumulative with
+     with an academy */
 
-    if (sk == SK_ENTERTAINMENT
-        && buildingtype_exists(r, bt_find("artacademy"), false)) {
-        days *= 2;
-    }
+  if (sk == SK_ENTERTAINMENT
+      && buildingtype_exists(r, bt_find("artacademy"), false)) {
+      days *= 2;
+  }
 
-    if (fval(u, UFL_HUNGER))
-        days /= 2;
+  if (fval(u, UFL_HUNGER))
+      days /= 2;
 
-    while (days) {
-        if (days >= u->number * 30) {
-            learn_skill(u, sk, 1.0);
-            days -= u->number * 30;
-        }
-        else {
-            double chance = (double)days / u->number / 30;
-            learn_skill(u, sk, chance);
-            days = 0;
-        }
-    }
-    if (a != NULL) {
-        if (teach != NULL) {
-            int index = 0;
-            while (teach->teachers[index] && index != MAXTEACHERS) {
-                unit *teacher = teach->teachers[index++];
-                if (teacher->faction != u->faction) {
-                    bool feedback = alliedunit(u, teacher->faction, HELP_GUARD);
-                    if (feedback) {
-                        ADDMSG(&teacher->faction->msgs, msg_message("teach_teacher",
-                            "teacher student skill level", teacher, u, sk,
-                            effskill(u, sk)));
-                    }
-                    ADDMSG(&u->faction->msgs, msg_message("teach_student",
-                        "teacher student skill", teacher, u, sk));
-                }
-            }
-        }
-        a_remove(&u->attribs, a);
-        a = NULL;
-    }
-    fset(u, UFL_LONGACTION | UFL_NOTMOVING);
+  while (days) {
+      if (days >= u->number * 30) {
+          learn_skill(u, sk, 1.0);
+          days -= u->number * 30;
+      }
+      else {
+          double chance = (double)days / u->number / 30;
+          learn_skill(u, sk, chance);
+          days = 0;
+      }
+  }
+  if (a != NULL) {
+      if (teach != NULL) {
+          int index = 0;
+          while (teach->teachers[index] && index != MAXTEACHERS) {
+              unit *teacher = teach->teachers[index++];
+              if (teacher->faction != u->faction) {
+                  bool feedback = alliedunit(u, teacher->faction, HELP_GUARD);
+                  if (feedback) {
+                      ADDMSG(&teacher->faction->msgs, msg_message("teach_teacher",
+                          "teacher student skill level", teacher, u, sk,
+                          effskill(u, sk)));
+                  }
+                  ADDMSG(&u->faction->msgs, msg_message("teach_student",
+                      "teacher student skill", teacher, u, sk));
+              }
+          }
+      }
+      a_remove(&u->attribs, a);
+      a = NULL;
+  }
+  fset(u, UFL_LONGACTION | UFL_NOTMOVING);
 
-    /* Anzeigen neuer Traenke */
-    /* Spruchlistenaktualiesierung ist in Regeneration */
+  /* Anzeigen neuer Traenke */
+  /* Spruchlistenaktualiesierung ist in Regeneration */
 
-    if (sk == SK_ALCHEMY) {
-        const potion_type *ptype;
-        faction *f = u->faction;
-        int skill = eff_skill(u, SK_ALCHEMY, r);
-        if (skill > maxalchemy) {
-            for (ptype = potiontypes; ptype; ptype = ptype->next) {
-                if (skill == ptype->level * 2) {
-                    attrib *a = a_find(f->attribs, &at_showitem);
-                    while (a && a->type == &at_showitem && a->data.v != ptype)
-                        a = a->next;
-                    if (a == NULL || a->type != &at_showitem) {
-                        a = a_add(&f->attribs, a_new(&at_showitem));
-                        a->data.v = (void *)ptype->itype;
-                    }
-                }
-            }
-        }
-    }
-    else if (sk == SK_MAGIC) {
-        sc_mage *mage = get_mage(u);
-        if (!mage) {
-            mage = create_mage(u, u->faction->magiegebiet);
-        }
-    }
+  if (sk == SK_ALCHEMY) {
+      const potion_type *ptype;
+      faction *f = u->faction;
+      int skill = eff_skill(u, SK_ALCHEMY, r);
+      if (skill > maxalchemy) {
+          for (ptype = potiontypes; ptype; ptype = ptype->next) {
+              if (skill == ptype->level * 2) {
+                  attrib *a = a_find(f->attribs, &at_showitem);
+                  while (a && a->type == &at_showitem && a->data.v != ptype)
+                      a = a->next;
+                  if (a == NULL || a->type != &at_showitem) {
+                      a = a_add(&f->attribs, a_new(&at_showitem));
+                      a->data.v = (void *)ptype->itype;
+                  }
+              }
+          }
+      }
+  }
+  else if (sk == SK_MAGIC) {
+      sc_mage *mage = get_mage(u);
+      if (!mage) {
+          mage = create_mage(u, u->faction->magiegebiet);
+      }
+  }
 
-    return 0;
+  return 0;
 }
diff --git a/src/study.h b/src/study.h
index 1783e1a28..e3e7e9e2c 100644
--- a/src/study.h
+++ b/src/study.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -25,20 +25,20 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  extern int teach_cmd(struct unit *u, struct order *ord);
-  extern int learn_cmd(struct unit *u, struct order *ord);
+    extern int teach_cmd(struct unit *u, struct order *ord);
+    extern int learn_cmd(struct unit *u, struct order *ord);
 
-  extern magic_t getmagicskill(const struct locale *lang);
-  extern bool is_migrant(struct unit *u);
-  extern int study_cost(struct unit *u, skill_t talent);
+    extern magic_t getmagicskill(const struct locale *lang);
+    extern bool is_migrant(struct unit *u);
+    extern int study_cost(struct unit *u, skill_t talent);
 
 #define MAXTEACHERS 4
-  typedef struct teaching_info {
-    struct unit *teachers[MAXTEACHERS];
-    int value;
-  } teaching_info;
+    typedef struct teaching_info {
+        struct unit *teachers[MAXTEACHERS];
+        int value;
+    } teaching_info;
 
-  extern const struct attrib_type at_learning;
+    extern const struct attrib_type at_learning;
 
 #ifdef __cplusplus
 }
diff --git a/src/summary.c b/src/summary.c
index 00b1eba8c..92405db33 100644
--- a/src/summary.c
+++ b/src/summary.c
@@ -1,11 +1,11 @@
-/* vi: set ts=2:
+/* 
  * +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  * |                   |  Enno Rehling <enno@eressea.de>
  * | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
- * | (c) 1998 - 2007   |  
+ * | (c) 1998 - 2007   |
  * |                   |  This program may not be used, modified or distributed
  * +-------------------+  without prior permission by the authors of Eressea.
- *  
+ *
  */
 
 /* wenn platform.h nicht vor curses included wird, kompiliert es unter windows nicht */
@@ -39,35 +39,35 @@
 #undef SUMMARY_BOM              /* write a BOM in the summary file */
 
 typedef struct summary {
-  int waffen;
-  int factions;
-  int ruestungen;
-  int schiffe;
-  int gebaeude;
-  int maxskill;
-  int heroes;
-  int inhabitedregions;
-  int peasants;
-  int nunits;
-  int playerpop;
-  double playermoney;
-  double peasantmoney;
-  int armed_men;
-  int poprace[MAXRACES];
-  int factionrace[MAXRACES];
-  int landregionen;
-  int regionen_mit_spielern;
-  int landregionen_mit_spielern;
-  int orkifizierte_regionen;
-  int inactive_volcanos;
-  int active_volcanos;
-  int spielerpferde;
-  int pferde;
-  struct language {
-    struct language *next;
-    int number;
-    const struct locale *locale;
-  } *languages;
+    int waffen;
+    int factions;
+    int ruestungen;
+    int schiffe;
+    int gebaeude;
+    int maxskill;
+    int heroes;
+    int inhabitedregions;
+    int peasants;
+    int nunits;
+    int playerpop;
+    double playermoney;
+    double peasantmoney;
+    int armed_men;
+    int poprace[MAXRACES];
+    int factionrace[MAXRACES];
+    int landregionen;
+    int regionen_mit_spielern;
+    int landregionen_mit_spielern;
+    int orkifizierte_regionen;
+    int inactive_volcanos;
+    int active_volcanos;
+    int spielerpferde;
+    int pferde;
+    struct language {
+        struct language *next;
+        int number;
+        const struct locale *locale;
+    } *languages;
 } summary;
 
 
@@ -104,242 +104,247 @@ int update_nmrs(void)
 
 static char *pcomp(double i, double j)
 {
-  static char buf[32];
-  sprintf(buf, "%.0f (%s%.0f)", i, (i >= j) ? "+" : "", i - j);
-  return buf;
+    static char buf[32];
+    sprintf(buf, "%.0f (%s%.0f)", i, (i >= j) ? "+" : "", i - j);
+    return buf;
 }
 
 static char *rcomp(int i, int j)
 {
-  static char buf[32];
-  sprintf(buf, "%d (%s%d,%s%d%%)",
-    i, (i >= j) ? "+" : "", i - j, (i >= j) ? "+" : "",
-    j ? ((i - j) * 100) / j : 0);
-  return buf;
+    static char buf[32];
+    sprintf(buf, "%d (%s%d,%s%d%%)",
+        i, (i >= j) ? "+" : "", i - j, (i >= j) ? "+" : "",
+        j ? ((i - j) * 100) / j : 0);
+    return buf;
 }
 
 static void out_faction(FILE * file, const struct faction *f)
 {
-  if (alliances != NULL) {
-    fprintf(file, "%s (%s/%d) (%.3s/%.3s), %d Einh., %d Pers., $%d, %d NMR\n",
-      f->name, itoa36(f->no), f_get_alliance(f) ? f->alliance->id : 0,
-      LOC(default_locale, rc_name_s(f->race, NAME_SINGULAR)), magic_school[f->magiegebiet],
-      count_units(f), f->num_total, f->money, turn - f->lastorders);
-  } else {
-    fprintf(file, "%s (%.3s/%.3s), %d Einh., %d Pers., $%d, %d NMR\n",
-      factionname(f), LOC(default_locale, rc_name_s(f->race, NAME_SINGULAR)),
-      magic_school[f->magiegebiet], count_units(f), f->num_total, f->money,
-      turn - f->lastorders);
-  }
+    if (alliances != NULL) {
+        fprintf(file, "%s (%s/%d) (%.3s/%.3s), %d Einh., %d Pers., $%d, %d NMR\n",
+            f->name, itoa36(f->no), f_get_alliance(f) ? f->alliance->id : 0,
+            LOC(default_locale, rc_name_s(f->race, NAME_SINGULAR)), magic_school[f->magiegebiet],
+            count_units(f), f->num_total, f->money, turn - f->lastorders);
+    }
+    else {
+        fprintf(file, "%s (%.3s/%.3s), %d Einh., %d Pers., $%d, %d NMR\n",
+            factionname(f), LOC(default_locale, rc_name_s(f->race, NAME_SINGULAR)),
+            magic_school[f->magiegebiet], count_units(f), f->num_total, f->money,
+            turn - f->lastorders);
+    }
 }
 
 static char *gamedate2(const struct locale *lang)
 {
-  static char buf[256];
-  gamedate gd;
+    static char buf[256];
+    gamedate gd;
 
-  get_gamedate(turn, &gd);
-  sprintf(buf, "in %s des Monats %s im Jahre %d %s.",
-    LOC(lang, weeknames2[gd.week]),
-    LOC(lang, monthnames[gd.month]),
-    gd.year, agename ? LOC(lang, agename) : "");
-  return buf;
+    get_gamedate(turn, &gd);
+    sprintf(buf, "in %s des Monats %s im Jahre %d %s.",
+        LOC(lang, weeknames2[gd.week]),
+        LOC(lang, monthnames[gd.month]),
+        gd.year, agename ? LOC(lang, agename) : "");
+    return buf;
 }
 
 static void writeturn(void)
 {
-  char zText[MAX_PATH];
-  FILE *f;
+    char zText[MAX_PATH];
+    FILE *f;
 
-  sprintf(zText, "%s/datum", basepath());
-  f = fopen(zText, "w");
-  if (!f) {
-    perror(zText);
-    return;
-  }
-  fputs(gamedate2(default_locale), f);
-  fclose(f);
-  sprintf(zText, "%s/turn", basepath());
-  f = fopen(zText, "w");
-  if (!f) {
-    perror(zText);
-    return;
-  }
-  fprintf(f, "%d\n", turn);
-  fclose(f);
+    sprintf(zText, "%s/datum", basepath());
+    f = fopen(zText, "w");
+    if (!f) {
+        perror(zText);
+        return;
+    }
+    fputs(gamedate2(default_locale), f);
+    fclose(f);
+    sprintf(zText, "%s/turn", basepath());
+    f = fopen(zText, "w");
+    if (!f) {
+        perror(zText);
+        return;
+    }
+    fprintf(f, "%d\n", turn);
+    fclose(f);
 }
 
 void report_summary(summary * s, summary * o, bool full)
 {
-  FILE *F = NULL;
-  int i, newplayers = 0;
-  faction *f;
-  char zText[MAX_PATH];
+    FILE *F = NULL;
+    int i, newplayers = 0;
+    faction *f;
+    char zText[MAX_PATH];
 
-  if (full) {
-    sprintf(zText, "%s/parteien.full", basepath());
-  } else {
-    sprintf(zText, "%s/parteien", basepath());
-  }
-  F = fopen(zText, "w");
-  if (!F) {
-    perror(zText);
-    return;
-  }
+    if (full) {
+        sprintf(zText, "%s/parteien.full", basepath());
+    }
+    else {
+        sprintf(zText, "%s/parteien", basepath());
+    }
+    F = fopen(zText, "w");
+    if (!F) {
+        perror(zText);
+        return;
+    }
 #ifdef SUMMARY_BOM
-  else {
-    const unsigned char utf8_bom[4] = { 0xef, 0xbb, 0xbf, 0 };
-    fwrite(utf8_bom, 1, 3, F);
-  }
+    else {
+        const unsigned char utf8_bom[4] = { 0xef, 0xbb, 0xbf, 0 };
+        fwrite(utf8_bom, 1, 3, F);
+    }
 #endif
-  log_info("writing summary to file: parteien.\n");
-  fprintf(F, "%s\n%s\n\n", game_name(), gamedate2(default_locale));
-  fprintf(F, "Auswertung Nr:         %d\n\n", turn);
-  fprintf(F, "Parteien:              %s\n", pcomp(s->factions, o->factions));
-  fprintf(F, "Einheiten:             %s\n", pcomp(s->nunits, o->nunits));
-  fprintf(F, "Spielerpopulation:     %s\n", pcomp(s->playerpop, o->playerpop));
-  fprintf(F, " davon bewaffnet:      %s\n", pcomp(s->armed_men, o->armed_men));
-  fprintf(F, " Helden:               %s\n", pcomp(s->heroes, o->heroes));
+    log_info("writing summary to file: parteien.\n");
+    fprintf(F, "%s\n%s\n\n", game_name(), gamedate2(default_locale));
+    fprintf(F, "Auswertung Nr:         %d\n\n", turn);
+    fprintf(F, "Parteien:              %s\n", pcomp(s->factions, o->factions));
+    fprintf(F, "Einheiten:             %s\n", pcomp(s->nunits, o->nunits));
+    fprintf(F, "Spielerpopulation:     %s\n", pcomp(s->playerpop, o->playerpop));
+    fprintf(F, " davon bewaffnet:      %s\n", pcomp(s->armed_men, o->armed_men));
+    fprintf(F, " Helden:               %s\n", pcomp(s->heroes, o->heroes));
 
-  if (full) {
-    fprintf(F, "Regionen:              %d\n", listlen(regions));
-    fprintf(F, "Bewohnte Regionen:     %d\n", s->inhabitedregions);
-    fprintf(F, "Landregionen:          %d\n", s->landregionen);
-    fprintf(F, "Spielerregionen:       %d\n", s->regionen_mit_spielern);
-    fprintf(F, "Landspielerregionen:   %d\n", s->landregionen_mit_spielern);
-    fprintf(F, "Orkifizierte Regionen: %d\n", s->orkifizierte_regionen);
-    fprintf(F, "Inaktive Vulkane:      %d\n", s->inactive_volcanos);
-    fprintf(F, "Aktive Vulkane:        %d\n\n", s->active_volcanos);
-  }
-
-  for (i = 0; i < MAXRACES; i++) {
-      if (i != RC_TEMPLATE && i != RC_CLONE && s->factionrace[i]) {
-          const race *rc = get_race(i);
-          if (rc && playerrace(rc)) {
-              fprintf(F, "%13s%s: %s\n", LOC(default_locale, rc_name_s(rc, NAME_CATEGORY)),
-                  LOC(default_locale, "stat_tribe_p"), pcomp(s->factionrace[i],
-                  o->factionrace[i]));
-          }
-      }
-  }
-
-  if (full) {
-    fprintf(F, "\n");
-    {
-      struct language *plang = s->languages;
-      while (plang != NULL) {
-        struct language *olang = o->languages;
-        int nold = 0;
-        while (olang && olang->locale != plang->locale)
-          olang = olang->next;
-        if (olang)
-          nold = olang->number;
-        fprintf(F, "Sprache %12s: %s\n", locale_name(plang->locale),
-          rcomp(plang->number, nold));
-        plang = plang->next;
-      }
+    if (full) {
+        fprintf(F, "Regionen:              %d\n", listlen(regions));
+        fprintf(F, "Bewohnte Regionen:     %d\n", s->inhabitedregions);
+        fprintf(F, "Landregionen:          %d\n", s->landregionen);
+        fprintf(F, "Spielerregionen:       %d\n", s->regionen_mit_spielern);
+        fprintf(F, "Landspielerregionen:   %d\n", s->landregionen_mit_spielern);
+        fprintf(F, "Orkifizierte Regionen: %d\n", s->orkifizierte_regionen);
+        fprintf(F, "Inaktive Vulkane:      %d\n", s->inactive_volcanos);
+        fprintf(F, "Aktive Vulkane:        %d\n\n", s->active_volcanos);
     }
-  }
 
-  fprintf(F, "\n");
-  if (full) {
     for (i = 0; i < MAXRACES; i++) {
-      if (s->poprace[i]) {
-          const race *rc = get_race(i);
-          fprintf(F, "%20s: %s\n", LOC(default_locale, rc_name_s(rc, NAME_PLURAL)),
-          rcomp(s->poprace[i], o->poprace[i]));
-      }
-    }
-  } else {
-      for (i = 0; i < MAXRACES; i++) {
-          if (i != RC_TEMPLATE && i != RC_CLONE && s->poprace[i]) {
-              const race *rc = get_race(i);
-              if (playerrace(rc)) {
-                  fprintf(F, "%20s: %s\n", LOC(default_locale, rc_name_s(rc, NAME_PLURAL)),
-                      rcomp(s->poprace[i], o->poprace[i]));
-              }
-          }
-      }
-    }
-
-  if (full) {
-    fprintf(F, "\nWaffen:               %s\n", pcomp(s->waffen, o->waffen));
-    fprintf(F, "Ruestungen:           %s\n",
-      pcomp(s->ruestungen, o->ruestungen));
-    fprintf(F, "ungezaehmte Pferde:   %s\n", pcomp(s->pferde, o->pferde));
-    fprintf(F, "gezaehmte Pferde:     %s\n",
-      pcomp(s->spielerpferde, o->spielerpferde));
-    fprintf(F, "Schiffe:              %s\n", pcomp(s->schiffe, o->schiffe));
-    fprintf(F, "Gebaeude:             %s\n", pcomp(s->gebaeude, o->gebaeude));
-
-    fprintf(F, "\nBauernpopulation:     %s\n", pcomp(s->peasants, o->peasants));
-
-    fprintf(F, "Population gesamt:    %d\n\n", s->playerpop + s->peasants);
-
-    fprintf(F, "Reichtum Spieler:     %s Silber\n",
-      pcomp(s->playermoney, o->playermoney));
-    fprintf(F, "Reichtum Bauern:      %s Silber\n",
-      pcomp(s->peasantmoney, o->peasantmoney));
-    fprintf(F, "Reichtum gesamt:      %s Silber\n\n",
-      pcomp(s->playermoney + s->peasantmoney,
-        o->playermoney + o->peasantmoney));
-  }
-
-  fprintf(F, "\n\n");
-
-  newplayers = update_nmrs();
-
-  for (i = 0; i <= NMRTimeout(); ++i) {
-    if (i == NMRTimeout()) {
-      fprintf(F, "+ NMR:\t\t %d\n", nmrs[i]);
-    } else {
-      fprintf(F, "%d NMR:\t\t %d\n", i, nmrs[i]);
-    }
-  }
-  if (age) {
-    if (age[2] != 0) {
-      fprintf(F, "Erstabgaben:\t %d%%\n", 100 - (dropouts[0] * 100 / age[2]));
-    }
-    if (age[3] != 0) {
-      fprintf(F, "Zweitabgaben:\t %d%%\n", 100 - (dropouts[1] * 100 / age[3]));
-    }
-  }
-  fprintf(F, "Neue Spieler:\t %d\n", newplayers);
-
-  if (full) {
-    if (factions)
-      fprintf(F, "\nParteien:\n\n");
-
-    for (f = factions; f; f = f->next) {
-      out_faction(F, f);
-    }
-
-    if (NMRTimeout() && full) {
-      fprintf(F, "\n\nFactions with NMRs:\n");
-      for (i = NMRTimeout(); i > 0; --i) {
-        for (f = factions; f; f = f->next) {
-          if (i == NMRTimeout()) {
-            if (turn - f->lastorders >= i) {
-              out_faction(F, f);
+        if (i != RC_TEMPLATE && i != RC_CLONE && s->factionrace[i]) {
+            const race *rc = get_race(i);
+            if (rc && playerrace(rc)) {
+                fprintf(F, "%13s%s: %s\n", LOC(default_locale, rc_name_s(rc, NAME_CATEGORY)),
+                    LOC(default_locale, "stat_tribe_p"), pcomp(s->factionrace[i],
+                    o->factionrace[i]));
             }
-          } else {
-            if (turn - f->lastorders == i) {
-              out_faction(F, f);
-            }
-          }
         }
-      }
     }
-  }
 
-  fclose(F);
+    if (full) {
+        fprintf(F, "\n");
+        {
+            struct language *plang = s->languages;
+            while (plang != NULL) {
+                struct language *olang = o->languages;
+                int nold = 0;
+                while (olang && olang->locale != plang->locale)
+                    olang = olang->next;
+                if (olang)
+                    nold = olang->number;
+                fprintf(F, "Sprache %12s: %s\n", locale_name(plang->locale),
+                    rcomp(plang->number, nold));
+                plang = plang->next;
+            }
+        }
+    }
 
-  if (full) {
-    log_info("writing date & turn\n");
-    writeturn();
-  }
-  free(nmrs);
-  nmrs = NULL;
+    fprintf(F, "\n");
+    if (full) {
+        for (i = 0; i < MAXRACES; i++) {
+            if (s->poprace[i]) {
+                const race *rc = get_race(i);
+                fprintf(F, "%20s: %s\n", LOC(default_locale, rc_name_s(rc, NAME_PLURAL)),
+                    rcomp(s->poprace[i], o->poprace[i]));
+            }
+        }
+    }
+    else {
+        for (i = 0; i < MAXRACES; i++) {
+            if (i != RC_TEMPLATE && i != RC_CLONE && s->poprace[i]) {
+                const race *rc = get_race(i);
+                if (playerrace(rc)) {
+                    fprintf(F, "%20s: %s\n", LOC(default_locale, rc_name_s(rc, NAME_PLURAL)),
+                        rcomp(s->poprace[i], o->poprace[i]));
+                }
+            }
+        }
+    }
+
+    if (full) {
+        fprintf(F, "\nWaffen:               %s\n", pcomp(s->waffen, o->waffen));
+        fprintf(F, "Ruestungen:           %s\n",
+            pcomp(s->ruestungen, o->ruestungen));
+        fprintf(F, "ungezaehmte Pferde:   %s\n", pcomp(s->pferde, o->pferde));
+        fprintf(F, "gezaehmte Pferde:     %s\n",
+            pcomp(s->spielerpferde, o->spielerpferde));
+        fprintf(F, "Schiffe:              %s\n", pcomp(s->schiffe, o->schiffe));
+        fprintf(F, "Gebaeude:             %s\n", pcomp(s->gebaeude, o->gebaeude));
+
+        fprintf(F, "\nBauernpopulation:     %s\n", pcomp(s->peasants, o->peasants));
+
+        fprintf(F, "Population gesamt:    %d\n\n", s->playerpop + s->peasants);
+
+        fprintf(F, "Reichtum Spieler:     %s Silber\n",
+            pcomp(s->playermoney, o->playermoney));
+        fprintf(F, "Reichtum Bauern:      %s Silber\n",
+            pcomp(s->peasantmoney, o->peasantmoney));
+        fprintf(F, "Reichtum gesamt:      %s Silber\n\n",
+            pcomp(s->playermoney + s->peasantmoney,
+            o->playermoney + o->peasantmoney));
+    }
+
+    fprintf(F, "\n\n");
+
+    newplayers = update_nmrs();
+
+    for (i = 0; i <= NMRTimeout(); ++i) {
+        if (i == NMRTimeout()) {
+            fprintf(F, "+ NMR:\t\t %d\n", nmrs[i]);
+        }
+        else {
+            fprintf(F, "%d NMR:\t\t %d\n", i, nmrs[i]);
+        }
+    }
+    if (age) {
+        if (age[2] != 0) {
+            fprintf(F, "Erstabgaben:\t %d%%\n", 100 - (dropouts[0] * 100 / age[2]));
+        }
+        if (age[3] != 0) {
+            fprintf(F, "Zweitabgaben:\t %d%%\n", 100 - (dropouts[1] * 100 / age[3]));
+        }
+    }
+    fprintf(F, "Neue Spieler:\t %d\n", newplayers);
+
+    if (full) {
+        if (factions)
+            fprintf(F, "\nParteien:\n\n");
+
+        for (f = factions; f; f = f->next) {
+            out_faction(F, f);
+        }
+
+        if (NMRTimeout() && full) {
+            fprintf(F, "\n\nFactions with NMRs:\n");
+            for (i = NMRTimeout(); i > 0; --i) {
+                for (f = factions; f; f = f->next) {
+                    if (i == NMRTimeout()) {
+                        if (turn - f->lastorders >= i) {
+                            out_faction(F, f);
+                        }
+                    }
+                    else {
+                        if (turn - f->lastorders == i) {
+                            out_faction(F, f);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    fclose(F);
+
+    if (full) {
+        log_info("writing date & turn\n");
+        writeturn();
+    }
+    free(nmrs);
+    nmrs = NULL;
 }
 
 summary *make_summary(void)
@@ -350,106 +355,107 @@ summary *make_summary(void)
     summary *s = calloc(1, sizeof(summary));
     const struct resource_type *rhorse = get_resourcetype(R_HORSE);
 
-  for (f = factions; f; f = f->next) {
-    const struct locale *lang = f->locale;
-    struct language *plang = s->languages;
-    while (plang && plang->locale != lang)
-      plang = plang->next;
-    if (!plang) {
-      plang = calloc(sizeof(struct language), 1);
-      plang->next = s->languages;
-      s->languages = plang;
-      plang->locale = lang;
-    }
-    ++plang->number;
-    f->nregions = 0;
-    f->num_total = 0;
-    f->money = 0;
-    if (f->alive && f->units) {
-      s->factions++;
-      /* Problem mit Monsterpartei ... */
-      if (!is_monsters(f)) {
-        s->factionrace[old_race(f->race)]++;
-      }
-    }
-  }
-
-  /* count everything */
-
-  for (r = regions; r; r = r->next) {
-    s->pferde += rhorses(r);
-    s->schiffe += listlen(r->ships);
-    s->gebaeude += listlen(r->buildings);
-    if (!fval(r->terrain, SEA_REGION)) {
-      s->landregionen++;
-      if (r->units) {
-        s->landregionen_mit_spielern++;
-      }
-      if (fval(r, RF_ORCIFIED)) {
-        s->orkifizierte_regionen++;
-      }
-      if (r->terrain == newterrain(T_VOLCANO)) {
-        s->inactive_volcanos++;
-      } else if (r->terrain == newterrain(T_VOLCANO_SMOKING)) {
-        s->active_volcanos++;
-      }
-    }
-    if (r->units) {
-      s->regionen_mit_spielern++;
-    }
-    if (rpeasants(r) || r->units) {
-      s->inhabitedregions++;
-      s->peasants += rpeasants(r);
-      s->peasantmoney += rmoney(r);
-
-      /* Einheiten Info. nregions darf nur einmal pro Partei
-       * incrementiert werden. */
-
-      for (u = r->units; u; u = u->next)
-        freset(u->faction, FFL_SELECT);
-      for (u = r->units; u; u = u->next) {
-        f = u->faction;
-        if (!is_monsters(u->faction)) {
-          skill *sv;
-          item *itm;
-
-          s->nunits++;
-          s->playerpop += u->number;
-          if (u->flags & UFL_HERO) {
-            s->heroes += u->number;
-          }
-          s->spielerpferde += i_get(u->items, rhorse->itype);
-          s->playermoney += get_money(u);
-          s->armed_men += armedmen(u, true);
-          for (itm = u->items; itm; itm = itm->next) {
-            if (itm->type->rtype->wtype) {
-              s->waffen += itm->number;
-            }
-            if (itm->type->rtype->atype) {
-              s->ruestungen += itm->number;
-            }
-          }
-
-          s->spielerpferde += i_get(u->items, rhorse->itype);
-
-          for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
-            skill_t sk = sv->id;
-            int aktskill = eff_skill(u, sk, r);
-            if (aktskill > s->maxskill)
-              s->maxskill = aktskill;
-          }
-          if (!fval(f, FFL_SELECT)) {
-            f->nregions++;
-            fset(f, FFL_SELECT);
-          }
+    for (f = factions; f; f = f->next) {
+        const struct locale *lang = f->locale;
+        struct language *plang = s->languages;
+        while (plang && plang->locale != lang)
+            plang = plang->next;
+        if (!plang) {
+            plang = calloc(sizeof(struct language), 1);
+            plang->next = s->languages;
+            s->languages = plang;
+            plang->locale = lang;
+        }
+        ++plang->number;
+        f->nregions = 0;
+        f->num_total = 0;
+        f->money = 0;
+        if (f->alive && f->units) {
+            s->factions++;
+            /* Problem mit Monsterpartei ... */
+            if (!is_monsters(f)) {
+                s->factionrace[old_race(f->race)]++;
+            }
         }
-
-        f->num_total += u->number;
-        f->money += get_money(u);
-        s->poprace[old_race(u_race(u))] += u->number;
-      }
     }
-  }
 
-  return s;
+    /* count everything */
+
+    for (r = regions; r; r = r->next) {
+        s->pferde += rhorses(r);
+        s->schiffe += listlen(r->ships);
+        s->gebaeude += listlen(r->buildings);
+        if (!fval(r->terrain, SEA_REGION)) {
+            s->landregionen++;
+            if (r->units) {
+                s->landregionen_mit_spielern++;
+            }
+            if (fval(r, RF_ORCIFIED)) {
+                s->orkifizierte_regionen++;
+            }
+            if (r->terrain == newterrain(T_VOLCANO)) {
+                s->inactive_volcanos++;
+            }
+            else if (r->terrain == newterrain(T_VOLCANO_SMOKING)) {
+                s->active_volcanos++;
+            }
+        }
+        if (r->units) {
+            s->regionen_mit_spielern++;
+        }
+        if (rpeasants(r) || r->units) {
+            s->inhabitedregions++;
+            s->peasants += rpeasants(r);
+            s->peasantmoney += rmoney(r);
+
+            /* Einheiten Info. nregions darf nur einmal pro Partei
+             * incrementiert werden. */
+
+            for (u = r->units; u; u = u->next)
+                freset(u->faction, FFL_SELECT);
+            for (u = r->units; u; u = u->next) {
+                f = u->faction;
+                if (!is_monsters(u->faction)) {
+                    skill *sv;
+                    item *itm;
+
+                    s->nunits++;
+                    s->playerpop += u->number;
+                    if (u->flags & UFL_HERO) {
+                        s->heroes += u->number;
+                    }
+                    s->spielerpferde += i_get(u->items, rhorse->itype);
+                    s->playermoney += get_money(u);
+                    s->armed_men += armedmen(u, true);
+                    for (itm = u->items; itm; itm = itm->next) {
+                        if (itm->type->rtype->wtype) {
+                            s->waffen += itm->number;
+                        }
+                        if (itm->type->rtype->atype) {
+                            s->ruestungen += itm->number;
+                        }
+                    }
+
+                    s->spielerpferde += i_get(u->items, rhorse->itype);
+
+                    for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
+                        skill_t sk = sv->id;
+                        int aktskill = eff_skill(u, sk, r);
+                        if (aktskill > s->maxskill)
+                            s->maxskill = aktskill;
+                    }
+                    if (!fval(f, FFL_SELECT)) {
+                        f->nregions++;
+                        fset(f, FFL_SELECT);
+                    }
+                }
+
+                f->num_total += u->number;
+                f->money += get_money(u);
+                s->poprace[old_race(u_race(u))] += u->number;
+            }
+        }
+    }
+
+    return s;
 }
diff --git a/src/summary.h b/src/summary.h
index ca65148e9..aa1491a21 100644
--- a/src/summary.h
+++ b/src/summary.h
@@ -1,11 +1,11 @@
-/* vi: set ts=2:
+/* 
  * +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  * |                   |  Enno Rehling <enno@eressea.de>
  * | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
- * | (c) 1998 - 2007   |  
+ * | (c) 1998 - 2007   |
  * |                   |  This program may not be used, modified or distributed
  * +-------------------+  without prior permission by the authors of Eressea.
- *  
+ *
  */
 
 #ifndef H_GC_SUMMARY
@@ -15,13 +15,13 @@
 extern "C" {
 #endif
 
-  struct summary;
+    struct summary;
 
-  void report_summary(struct summary *n, struct summary *o, bool full);
-  struct summary *make_summary(void);
+    void report_summary(struct summary *n, struct summary *o, bool full);
+    struct summary *make_summary(void);
 
-  int update_nmrs(void);
-  extern int* nmrs;
+    int update_nmrs(void);
+    extern int* nmrs;
 
 
 #ifdef __cplusplus
diff --git a/src/tests.c b/src/tests.c
index 83c6fe6fa..0d113229b 100644
--- a/src/tests.c
+++ b/src/tests.c
@@ -26,28 +26,28 @@
 
 struct race *test_create_race(const char *name)
 {
-  race *rc = rc_get_or_create(name);
-  rc->maintenance = 10;
-  rc->ec_flags |= GETITEM | GIVEITEM;
-  return rc;
+    race *rc = rc_get_or_create(name);
+    rc->maintenance = 10;
+    rc->ec_flags |= GETITEM | GIVEITEM;
+    return rc;
 }
 
 struct region *test_create_region(int x, int y, const terrain_type *terrain)
 {
-  region *r = new_region(x, y, NULL, 0);
-  terraform_region(r, terrain ? terrain : get_or_create_terrain("plain"));
-  rsettrees(r, 0, 0);
-  rsettrees(r, 1, 0);
-  rsettrees(r, 2, 0);
-  rsethorses(r, 0);
-  rsetpeasants(r, r->terrain->size);
-  return r;
+    region *r = new_region(x, y, NULL, 0);
+    terraform_region(r, terrain ? terrain : get_or_create_terrain("plain"));
+    rsettrees(r, 0, 0);
+    rsettrees(r, 1, 0);
+    rsettrees(r, 2, 0);
+    rsethorses(r, 0);
+    rsetpeasants(r, r->terrain->size);
+    return r;
 }
 
 struct faction *test_create_faction(const struct race *rc)
 {
-  faction *f = addfaction("nobody@eressea.de", NULL, rc?rc:rc_get_or_create("human"), default_locale, 0);
-  return f;
+    faction *f = addfaction("nobody@eressea.de", NULL, rc ? rc : rc_get_or_create("human"), default_locale, 0);
+    return f;
 }
 
 struct unit *test_create_unit(struct faction *f, struct region *r)
@@ -76,30 +76,30 @@ void test_cleanup(void)
 terrain_type *
 test_create_terrain(const char * name, unsigned int flags)
 {
-  terrain_type * t = get_or_create_terrain(name);
-  t->flags = flags;
-  return t;
+    terrain_type * t = get_or_create_terrain(name);
+    t->flags = flags;
+    return t;
 }
 
 building * test_create_building(region * r, const building_type * btype)
 {
-  building * b = new_building(btype?btype:bt_get_or_create("castle"), r, default_locale);
-  b->size = b->type->maxsize>0?b->type->maxsize:1;
-  return b;
+    building * b = new_building(btype ? btype : bt_get_or_create("castle"), r, default_locale);
+    b->size = b->type->maxsize > 0 ? b->type->maxsize : 1;
+    return b;
 }
 
 ship * test_create_ship(region * r, const ship_type * stype)
 {
-  ship * s = new_ship(stype?stype:st_get_or_create("boat"), r, default_locale);
-  s->size = s->type->construction?s->type->construction->maxsize:1;
-  return s;
+    ship * s = new_ship(stype ? stype : st_get_or_create("boat"), r, default_locale);
+    s->size = s->type->construction ? s->type->construction->maxsize : 1;
+    return s;
 }
 
 ship_type * test_create_shiptype(const char * name)
 {
-  ship_type * stype = st_get_or_create(name);
-  locale_setstring(default_locale, name, name);
-  return stype;
+    ship_type * stype = st_get_or_create(name);
+    locale_setstring(default_locale, name, name);
+    return stype;
 }
 
 building_type * test_create_buildingtype(const char * name)
@@ -124,18 +124,18 @@ building_type * test_create_buildingtype(const char * name)
 }
 
 item_type * test_create_itemtype(const char * name) {
-  resource_type * rtype;
-  item_type * itype;
+    resource_type * rtype;
+    item_type * itype;
 
-  rtype = rt_get_or_create(name);
-  itype = it_get_or_create(rtype);
+    rtype = rt_get_or_create(name);
+    itype = it_get_or_create(rtype);
 
-  return itype;
+    return itype;
 }
 
 void test_translate_param(const struct locale *lang, param_t param, const char *text) {
     struct critbit_tree **cb;
-    
+
     assert(lang && text);
     cb = (struct critbit_tree **)get_translations(lang, UT_PARAMS);
     add_translation(cb, text, param);
@@ -150,48 +150,48 @@ void test_translate_param(const struct locale *lang, param_t param, const char *
  */
 void test_create_world(void)
 {
-  terrain_type *t_plain, *t_ocean;
-  region *island[2];
-  int i;
-  item_type * itype;
-  struct locale * loc;
+    terrain_type *t_plain, *t_ocean;
+    region *island[2];
+    int i;
+    item_type * itype;
+    struct locale * loc;
 
-  loc = get_or_create_locale("de");
-  locale_setstring(loc, keyword(K_RESERVE), "RESERVIEREN");
-  locale_setstring(loc, "money", "SILBER");
-  init_resources();
+    loc = get_or_create_locale("de");
+    locale_setstring(loc, keyword(K_RESERVE), "RESERVIEREN");
+    locale_setstring(loc, "money", "SILBER");
+    init_resources();
 
-  itype = test_create_itemtype("horse");
-  itype->flags |= ITF_BIG | ITF_ANIMAL;
-  itype->weight = 5000;
-  itype->capacity = 7000;
+    itype = test_create_itemtype("horse");
+    itype->flags |= ITF_BIG | ITF_ANIMAL;
+    itype->weight = 5000;
+    itype->capacity = 7000;
 
-  test_create_itemtype("iron");
-  test_create_itemtype("stone");
+    test_create_itemtype("iron");
+    test_create_itemtype("stone");
 
-  t_plain = test_create_terrain("plain", LAND_REGION | FOREST_REGION | WALK_INTO | CAVALRY_REGION);
-  t_plain->size = 1000;
-  t_plain->max_road = 100;
-  t_ocean = test_create_terrain("ocean", SEA_REGION | SAIL_INTO | SWIM_INTO);
-  t_ocean->size = 0;
+    t_plain = test_create_terrain("plain", LAND_REGION | FOREST_REGION | WALK_INTO | CAVALRY_REGION);
+    t_plain->size = 1000;
+    t_plain->max_road = 100;
+    t_ocean = test_create_terrain("ocean", SEA_REGION | SAIL_INTO | SWIM_INTO);
+    t_ocean->size = 0;
 
-  island[0] = test_create_region(0, 0, t_plain);
-  island[1] = test_create_region(1, 0, t_plain);
-  for (i = 0; i != 2; ++i) {
-    int j;
-    region *r = island[i];
-    for (j = 0; j != MAXDIRECTIONS; ++j) {
-      region *rn = r_connect(r, (direction_t)j);
-      if (!rn) {
-        rn = test_create_region(r->x + delta_x[j], r->y + delta_y[j], t_ocean);
-      }
+    island[0] = test_create_region(0, 0, t_plain);
+    island[1] = test_create_region(1, 0, t_plain);
+    for (i = 0; i != 2; ++i) {
+        int j;
+        region *r = island[i];
+        for (j = 0; j != MAXDIRECTIONS; ++j) {
+            region *rn = r_connect(r, (direction_t)j);
+            if (!rn) {
+                rn = test_create_region(r->x + delta_x[j], r->y + delta_y[j], t_ocean);
+            }
+        }
     }
-  }
 
-  test_create_race("human");
+    test_create_race("human");
 
-  test_create_buildingtype("castle");
-  test_create_shiptype("boat");
+    test_create_buildingtype("castle");
+    test_create_shiptype("boat");
 }
 
 message * test_get_last_message(message_list *msgs) {
diff --git a/src/tests.test.c b/src/tests.test.c
index 06b59b175..3a9732609 100644
--- a/src/tests.test.c
+++ b/src/tests.test.c
@@ -36,44 +36,44 @@ static void test_resources(CuTest *tc) {
 
 static void test_recreate_world(CuTest * tc)
 {
-  test_cleanup();
-  CuAssertPtrEquals(tc, 0, get_locale("de"));
-  CuAssertPtrEquals(tc, 0, (void *)rt_find("horse"));
+    test_cleanup();
+    CuAssertPtrEquals(tc, 0, get_locale("de"));
+    CuAssertPtrEquals(tc, 0, (void *)rt_find("horse"));
 
-  test_create_world();
-  CuAssertPtrEquals(tc, default_locale, get_locale("de"));
-  CuAssertPtrNotNull(tc, default_locale);
-  CuAssertPtrNotNull(tc, findregion(0, 0));
-  CuAssertPtrNotNull(tc, get_terrain("plain"));
-  CuAssertPtrNotNull(tc, get_terrain("ocean"));
-  CuAssertPtrNotNull(tc, (void *)rt_find("horse"));
-  CuAssertPtrNotNull(tc, get_resourcetype(R_HORSE));
-  CuAssertPtrNotNull(tc, (void *)rt_find("money"));
-  CuAssertPtrNotNull(tc, get_resourcetype(R_LIFE));
-  CuAssertPtrNotNull(tc, get_resourcetype(R_SILVER));
-  CuAssertPtrNotNull(tc, get_resourcetype(R_AURA));
-  CuAssertPtrNotNull(tc, get_resourcetype(R_PERMAURA));
-  CuAssertPtrNotNull(tc, get_resourcetype(R_PEASANT));
+    test_create_world();
+    CuAssertPtrEquals(tc, default_locale, get_locale("de"));
+    CuAssertPtrNotNull(tc, default_locale);
+    CuAssertPtrNotNull(tc, findregion(0, 0));
+    CuAssertPtrNotNull(tc, get_terrain("plain"));
+    CuAssertPtrNotNull(tc, get_terrain("ocean"));
+    CuAssertPtrNotNull(tc, (void *)rt_find("horse"));
+    CuAssertPtrNotNull(tc, get_resourcetype(R_HORSE));
+    CuAssertPtrNotNull(tc, (void *)rt_find("money"));
+    CuAssertPtrNotNull(tc, get_resourcetype(R_LIFE));
+    CuAssertPtrNotNull(tc, get_resourcetype(R_SILVER));
+    CuAssertPtrNotNull(tc, get_resourcetype(R_AURA));
+    CuAssertPtrNotNull(tc, get_resourcetype(R_PERMAURA));
+    CuAssertPtrNotNull(tc, get_resourcetype(R_PEASANT));
 
-  test_cleanup();
-  CuAssertPtrEquals(tc, 0, get_locale("de"));
-  CuAssertPtrEquals(tc, 0, (void*)get_terrain("plain"));
-  CuAssertPtrEquals(tc, 0, (void*)get_terrain("ocean"));
-  CuAssertPtrEquals(tc, 0, (void*)rt_find("horse"));
-  CuAssertPtrEquals(tc, 0, (void*)get_resourcetype(R_HORSE));
-  CuAssertPtrEquals(tc, 0, (void *)rt_find("money"));
-  CuAssertPtrEquals(tc, 0, (void *)get_resourcetype(R_LIFE));
-  CuAssertPtrEquals(tc, 0, (void *)get_resourcetype(R_SILVER));
-  CuAssertPtrEquals(tc, 0, (void *)get_resourcetype(R_AURA));
-  CuAssertPtrEquals(tc, 0, (void *)get_resourcetype(R_PERMAURA));
-  CuAssertPtrEquals(tc, 0, (void *)get_resourcetype(R_PEASANT));
-  CuAssertPtrEquals(tc, 0, findregion(0, 0));
+    test_cleanup();
+    CuAssertPtrEquals(tc, 0, get_locale("de"));
+    CuAssertPtrEquals(tc, 0, (void*)get_terrain("plain"));
+    CuAssertPtrEquals(tc, 0, (void*)get_terrain("ocean"));
+    CuAssertPtrEquals(tc, 0, (void*)rt_find("horse"));
+    CuAssertPtrEquals(tc, 0, (void*)get_resourcetype(R_HORSE));
+    CuAssertPtrEquals(tc, 0, (void *)rt_find("money"));
+    CuAssertPtrEquals(tc, 0, (void *)get_resourcetype(R_LIFE));
+    CuAssertPtrEquals(tc, 0, (void *)get_resourcetype(R_SILVER));
+    CuAssertPtrEquals(tc, 0, (void *)get_resourcetype(R_AURA));
+    CuAssertPtrEquals(tc, 0, (void *)get_resourcetype(R_PERMAURA));
+    CuAssertPtrEquals(tc, 0, (void *)get_resourcetype(R_PEASANT));
+    CuAssertPtrEquals(tc, 0, findregion(0, 0));
 }
 
 CuSuite *get_tests_suite(void)
 {
-  CuSuite *suite = CuSuiteNew();
-  SUITE_ADD_TEST(suite, test_resources);
-  SUITE_ADD_TEST(suite, test_recreate_world);
-  return suite;
+    CuSuite *suite = CuSuiteNew();
+    SUITE_ADD_TEST(suite, test_resources);
+    SUITE_ADD_TEST(suite, test_recreate_world);
+    return suite;
 }
diff --git a/src/tools/atoi36.c b/src/tools/atoi36.c
index b93fab3a4..a0ddaad04 100644
--- a/src/tools/atoi36.c
+++ b/src/tools/atoi36.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
diff --git a/src/tools/namegen.c b/src/tools/namegen.c
index 924524179..2abcd0007 100644
--- a/src/tools/namegen.c
+++ b/src/tools/namegen.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
diff --git a/src/triggers/changefaction.c b/src/triggers/changefaction.c
index dfdaf80a2..6d8b24a80 100644
--- a/src/triggers/changefaction.c
+++ b/src/triggers/changefaction.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -45,64 +45,65 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  **/
 
 typedef struct changefaction_data {
-  struct unit *unit;
-  struct faction *faction;
+    struct unit *unit;
+    struct faction *faction;
 } changefaction_data;
 
 static void changefaction_init(trigger * t)
 {
-  t->data.v = calloc(sizeof(changefaction_data), 1);
+    t->data.v = calloc(sizeof(changefaction_data), 1);
 }
 
 static void changefaction_free(trigger * t)
 {
-  free(t->data.v);
+    free(t->data.v);
 }
 
 static int changefaction_handle(trigger * t, void *data)
 {
-  /* call an event handler on changefaction.
-   * data.v -> ( variant event, int timer )
-   */
-  changefaction_data *td = (changefaction_data *) t->data.v;
-  if (td->unit && td->faction) {
-    u_setfaction(td->unit, td->faction);
-  } else {
-    log_error("could not perform changefaction::handle()\n");
-  }
-  unused_arg(data);
-  return 0;
+    /* call an event handler on changefaction.
+     * data.v -> ( variant event, int timer )
+     */
+    changefaction_data *td = (changefaction_data *)t->data.v;
+    if (td->unit && td->faction) {
+        u_setfaction(td->unit, td->faction);
+    }
+    else {
+        log_error("could not perform changefaction::handle()\n");
+    }
+    unused_arg(data);
+    return 0;
 }
 
 static void changefaction_write(const trigger * t, struct storage *store)
 {
-  changefaction_data *td = (changefaction_data *) t->data.v;
-  write_unit_reference(td->unit, store);
-  write_faction_reference(td->faction, store);
+    changefaction_data *td = (changefaction_data *)t->data.v;
+    write_unit_reference(td->unit, store);
+    write_faction_reference(td->faction, store);
 }
 
 static int changefaction_read(trigger * t, struct storage *store)
 {
-  changefaction_data *td = (changefaction_data *) t->data.v;
-  read_reference(&td->unit, store, read_unit_reference, resolve_unit);
-  read_reference(&td->faction, store, read_faction_reference, resolve_faction);
-  return AT_READ_OK;
+    changefaction_data *td = (changefaction_data *)t->data.v;
+    read_reference(&td->unit, store, read_unit_reference, resolve_unit);
+    read_reference(&td->faction, store, read_faction_reference, resolve_faction);
+    return AT_READ_OK;
 }
 
 trigger_type tt_changefaction = {
-  "changefaction",
-  changefaction_init,
-  changefaction_free,
-  changefaction_handle,
-  changefaction_write,
-  changefaction_read
+    "changefaction",
+    changefaction_init,
+    changefaction_free,
+    changefaction_handle,
+    changefaction_write,
+    changefaction_read
 };
 
 trigger *trigger_changefaction(unit * u, struct faction * f)
 {
-  trigger *t = t_new(&tt_changefaction);
-  changefaction_data *td = (changefaction_data *) t->data.v;
-  td->unit = u;
-  td->faction = f;
-  return t;
+    trigger *t = t_new(&tt_changefaction);
+    changefaction_data *td = (changefaction_data *)t->data.v;
+    td->unit = u;
+    td->faction = f;
+    return t;
 }
diff --git a/src/triggers/changefaction.h b/src/triggers/changefaction.h
index 02039d9f0..ae4e28125 100644
--- a/src/triggers/changefaction.h
+++ b/src/triggers/changefaction.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,16 +22,16 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-/* all types we use are defined here to reduce dependencies */
-  struct trigger_type;
-  struct trigger;
+    /* all types we use are defined here to reduce dependencies */
+    struct trigger_type;
+    struct trigger;
 
-  struct unit;
-  struct faction;
+    struct unit;
+    struct faction;
 
-  extern struct trigger_type tt_changefaction;
+    extern struct trigger_type tt_changefaction;
 
-  extern struct trigger *trigger_changefaction(struct unit *u,
+    extern struct trigger *trigger_changefaction(struct unit *u,
     struct faction *f);
 
 #ifdef __cplusplus
diff --git a/src/triggers/changerace.c b/src/triggers/changerace.c
index 98ff0fcd8..b690d1d5a 100644
--- a/src/triggers/changerace.c
+++ b/src/triggers/changerace.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -44,74 +44,75 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  **/
 
 typedef struct changerace_data {
-  struct unit *u;
-  const struct race *race;
-  const struct race *irace;
+    struct unit *u;
+    const struct race *race;
+    const struct race *irace;
 } changerace_data;
 
 static void changerace_init(trigger * t)
 {
-  t->data.v = calloc(sizeof(changerace_data), 1);
+    t->data.v = calloc(sizeof(changerace_data), 1);
 }
 
 static void changerace_free(trigger * t)
 {
-  free(t->data.v);
+    free(t->data.v);
 }
 
 static int changerace_handle(trigger * t, void *data)
 {
-  /* call an event handler on changerace.
-   * data.v -> ( variant event, int timer )
-   */
-  changerace_data *td = (changerace_data *) t->data.v;
-  if (td->u) {
-    if (td->race != NULL)
-      u_setrace(td->u, td->race);
-    if (td->irace != NULL)
-      td->u->irace = td->irace;
-  } else {
-    log_error("could not perform changerace::handle()\n");
-  }
-  unused_arg(data);
-  return 0;
+    /* call an event handler on changerace.
+     * data.v -> ( variant event, int timer )
+     */
+    changerace_data *td = (changerace_data *)t->data.v;
+    if (td->u) {
+        if (td->race != NULL)
+            u_setrace(td->u, td->race);
+        if (td->irace != NULL)
+            td->u->irace = td->irace;
+    }
+    else {
+        log_error("could not perform changerace::handle()\n");
+    }
+    unused_arg(data);
+    return 0;
 }
 
 static void changerace_write(const trigger * t, struct storage *store)
 {
-  changerace_data *td = (changerace_data *) t->data.v;
-  write_unit_reference(td->u, store);
-  write_race_reference(td->race, store);
-  write_race_reference(td->irace, store);
+    changerace_data *td = (changerace_data *)t->data.v;
+    write_unit_reference(td->u, store);
+    write_race_reference(td->race, store);
+    write_race_reference(td->irace, store);
 }
 
 static int changerace_read(trigger * t, struct storage *store)
 {
-  changerace_data *td = (changerace_data *) t->data.v;
-  read_reference(&td->u, store, read_unit_reference, resolve_unit);
-  td->race = (const struct race *)read_race_reference(store).v;
-  td->irace = (const struct race *)read_race_reference(store).v;
-  return AT_READ_OK;
+    changerace_data *td = (changerace_data *)t->data.v;
+    read_reference(&td->u, store, read_unit_reference, resolve_unit);
+    td->race = (const struct race *)read_race_reference(store).v;
+    td->irace = (const struct race *)read_race_reference(store).v;
+    return AT_READ_OK;
 }
 
 trigger_type tt_changerace = {
-  "changerace",
-  changerace_init,
-  changerace_free,
-  changerace_handle,
-  changerace_write,
-  changerace_read
+    "changerace",
+    changerace_init,
+    changerace_free,
+    changerace_handle,
+    changerace_write,
+    changerace_read
 };
 
 trigger *trigger_changerace(struct unit * u, const struct race * prace,
-  const struct race * irace)
+    const struct race * irace)
 {
-  trigger *t = t_new(&tt_changerace);
-  changerace_data *td = (changerace_data *) t->data.v;
+    trigger *t = t_new(&tt_changerace);
+    changerace_data *td = (changerace_data *)t->data.v;
 
-  assert(u_race(u) == u_irace(u) || "!changerace-triggers cannot stack!");
-  td->u = u;
-  td->race = prace;
-  td->irace = irace;
-  return t;
+    assert(u_race(u) == u_irace(u) || "!changerace-triggers cannot stack!");
+    td->u = u;
+    td->race = prace;
+    td->irace = irace;
+    return t;
 }
diff --git a/src/triggers/changerace.h b/src/triggers/changerace.h
index b04b1a3e1..29ff2f397 100644
--- a/src/triggers/changerace.h
+++ b/src/triggers/changerace.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,15 +22,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-/* all types we use are defined here to reduce dependencies */
-  struct trigger_type;
-  struct trigger;
-  struct unit;
+    /* all types we use are defined here to reduce dependencies */
+    struct trigger_type;
+    struct trigger;
+    struct unit;
 
-  extern struct trigger_type tt_changerace;
+    extern struct trigger_type tt_changerace;
 
-  extern struct trigger *trigger_changerace(struct unit *u,
-    const struct race *urace, const struct race *irace);
+    extern struct trigger *trigger_changerace(struct unit *u,
+        const struct race *urace, const struct race *irace);
 
 #ifdef __cplusplus
 }
diff --git a/src/triggers/clonedied.c b/src/triggers/clonedied.c
index 898597cbf..6abdbc5d3 100644
--- a/src/triggers/clonedied.c
+++ b/src/triggers/clonedied.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -42,53 +42,54 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 /**
   clonedied.
-  
+
   This trigger ist called when a clone of a mage dies.
   It simply removes the clone-attribute from the mage.
- */
+  */
 
 static int clonedied_handle(trigger * t, void *data)
 {
-  /* destroy the unit */
-  unit *u = (unit *) t->data.v;
-  if (u) {
-    attrib *a = a_find(u->attribs, &at_clone);
-    if (a)
-      a_remove(&u->attribs, a);
-  } else
-    log_error("could not perform clonedied::handle()\n");
-  unused_arg(data);
-  return 0;
+    /* destroy the unit */
+    unit *u = (unit *)t->data.v;
+    if (u) {
+        attrib *a = a_find(u->attribs, &at_clone);
+        if (a)
+            a_remove(&u->attribs, a);
+    }
+    else
+        log_error("could not perform clonedied::handle()\n");
+    unused_arg(data);
+    return 0;
 }
 
 static void clonedied_write(const trigger * t, struct storage *store)
 {
-  unit *u = (unit *) t->data.v;
-  write_unit_reference(u, store);
+    unit *u = (unit *)t->data.v;
+    write_unit_reference(u, store);
 }
 
 static int clonedied_read(trigger * t, struct storage *store)
 {
-  int result =
-    read_reference(&t->data.v, store, read_unit_reference, resolve_unit);
-  if (result == 0 && t->data.v == NULL) {
-    return AT_READ_FAIL;
-  }
-  return AT_READ_OK;
+    int result =
+        read_reference(&t->data.v, store, read_unit_reference, resolve_unit);
+    if (result == 0 && t->data.v == NULL) {
+        return AT_READ_FAIL;
+    }
+    return AT_READ_OK;
 }
 
 trigger_type tt_clonedied = {
-  "clonedied",
-  NULL,
-  NULL,
-  clonedied_handle,
-  clonedied_write,
-  clonedied_read
+    "clonedied",
+    NULL,
+    NULL,
+    clonedied_handle,
+    clonedied_write,
+    clonedied_read
 };
 
 trigger *trigger_clonedied(unit * u)
 {
-  trigger *t = t_new(&tt_clonedied);
-  t->data.v = (void *)u;
-  return t;
+    trigger *t = t_new(&tt_clonedied);
+    t->data.v = (void *)u;
+    return t;
 }
diff --git a/src/triggers/clonedied.h b/src/triggers/clonedied.h
index 51b846057..4b6abde8e 100644
--- a/src/triggers/clonedied.h
+++ b/src/triggers/clonedied.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,13 +22,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  struct trigger_type;
-  struct trigger;
+    struct trigger_type;
+    struct trigger;
 
-  struct unit;
+    struct unit;
 
-  extern struct trigger_type tt_clonedied;
-  extern struct trigger *trigger_clonedied(struct unit *u);
+    extern struct trigger_type tt_clonedied;
+    struct trigger *trigger_clonedied(struct unit *u);
 
 #ifdef __cplusplus
 }
diff --git a/src/triggers/createcurse.c b/src/triggers/createcurse.c
index e426fd973..2ff69f801 100644
--- a/src/triggers/createcurse.c
+++ b/src/triggers/createcurse.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/triggers/createcurse.h b/src/triggers/createcurse.h
index 84fd33a77..2584ae311 100644
--- a/src/triggers/createcurse.h
+++ b/src/triggers/createcurse.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,19 +22,19 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-/* all types we use are defined here to reduce dependencies */
-  struct curse_type;
-  struct trigger_type;
-  struct trigger;
-  struct region;
-  struct faction;
-  struct unit;
+    /* all types we use are defined here to reduce dependencies */
+    struct curse_type;
+    struct trigger_type;
+    struct trigger;
+    struct region;
+    struct faction;
+    struct unit;
 
-  extern struct trigger_type tt_createcurse;
+    extern struct trigger_type tt_createcurse;
 
-  extern struct trigger *trigger_createcurse(struct unit *mage,
+    struct trigger *trigger_createcurse(struct unit *mage,
     struct unit *target, const struct curse_type *ct, float vigour,
-    int duration, float effect, int men);
+        int duration, float effect, int men);
 
 #ifdef __cplusplus
 }
diff --git a/src/triggers/createunit.c b/src/triggers/createunit.c
index ade3fff93..0275ea625 100644
--- a/src/triggers/createunit.c
+++ b/src/triggers/createunit.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -47,83 +47,84 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  **/
 
 typedef struct createunit_data {
-  struct region *r;
-  struct faction *f;
-  const struct race *race;
-  int number;
+    struct region *r;
+    struct faction *f;
+    const struct race *race;
+    int number;
 } createunit_data;
 
 static void createunit_init(trigger * t)
 {
-  t->data.v = calloc(sizeof(createunit_data), 1);
+    t->data.v = calloc(sizeof(createunit_data), 1);
 }
 
 static void createunit_free(trigger * t)
 {
-  free(t->data.v);
+    free(t->data.v);
 }
 
 static int createunit_handle(trigger * t, void *data)
 {
-  /* call an event handler on createunit.
-   * data.v -> ( variant event, int timer )
-   */
-  createunit_data *td = (createunit_data *) t->data.v;
-  if (td->r != NULL && td->f != NULL) {
-    create_unit(td->r, td->f, td->number, td->race, 0, NULL, NULL);
-  } else {
-    log_error("could not perform createunit::handle()\n");
-  }
-  unused_arg(data);
-  return 0;
+    /* call an event handler on createunit.
+     * data.v -> ( variant event, int timer )
+     */
+    createunit_data *td = (createunit_data *)t->data.v;
+    if (td->r != NULL && td->f != NULL) {
+        create_unit(td->r, td->f, td->number, td->race, 0, NULL, NULL);
+    }
+    else {
+        log_error("could not perform createunit::handle()\n");
+    }
+    unused_arg(data);
+    return 0;
 }
 
 static void createunit_write(const trigger * t, struct storage *store)
 {
-  createunit_data *td = (createunit_data *) t->data.v;
-  write_faction_reference(td->f, store);
-  write_region_reference(td->r, store);
-  write_race_reference(td->race, store);
-  WRITE_INT(store, td->number);
+    createunit_data *td = (createunit_data *)t->data.v;
+    write_faction_reference(td->f, store);
+    write_region_reference(td->r, store);
+    write_race_reference(td->race, store);
+    WRITE_INT(store, td->number);
 }
 
 static int createunit_read(trigger * t, struct storage *store)
 {
-  createunit_data *td = (createunit_data *) t->data.v;
+    createunit_data *td = (createunit_data *)t->data.v;
 
-  int uc =
-    read_reference(&td->f, store, read_faction_reference, resolve_faction);
-  int rc =
-    read_reference(&td->r, store, read_region_reference,
-    RESOLVE_REGION(global.data_version));
-  td->race = (const struct race *)read_race_reference(store).v;
+    int uc =
+        read_reference(&td->f, store, read_faction_reference, resolve_faction);
+    int rc =
+        read_reference(&td->r, store, read_region_reference,
+        RESOLVE_REGION(global.data_version));
+    td->race = (const struct race *)read_race_reference(store).v;
 
-  if (uc == 0 && rc == 0) {
-    if (!td->f || !td->r)
-      return AT_READ_FAIL;
-  }
-  READ_INT(store, &td->number);
+    if (uc == 0 && rc == 0) {
+        if (!td->f || !td->r)
+            return AT_READ_FAIL;
+    }
+    READ_INT(store, &td->number);
 
-  return AT_READ_OK;
+    return AT_READ_OK;
 }
 
 trigger_type tt_createunit = {
-  "createunit",
-  createunit_init,
-  createunit_free,
-  createunit_handle,
-  createunit_write,
-  createunit_read
+    "createunit",
+    createunit_init,
+    createunit_free,
+    createunit_handle,
+    createunit_write,
+    createunit_read
 };
 
 trigger *trigger_createunit(region * r, struct faction * f,
-  const struct race * rc, int number)
+    const struct race * rc, int number)
 {
-  trigger *t = t_new(&tt_createunit);
-  createunit_data *td = (createunit_data *) t->data.v;
-  td->r = r;
-  td->f = f;
-  td->race = rc;
-  td->number = number;
-  return t;
+    trigger *t = t_new(&tt_createunit);
+    createunit_data *td = (createunit_data *)t->data.v;
+    td->r = r;
+    td->f = f;
+    td->race = rc;
+    td->number = number;
+    return t;
 }
diff --git a/src/triggers/createunit.h b/src/triggers/createunit.h
index bd9d02c71..9dc1ba98a 100644
--- a/src/triggers/createunit.h
+++ b/src/triggers/createunit.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,17 +22,17 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-/* all types we use are defined here to reduce dependencies */
-  struct trigger_type;
-  struct trigger;
-  struct region;
-  struct faction;
-  struct unit;
+    /* all types we use are defined here to reduce dependencies */
+    struct trigger_type;
+    struct trigger;
+    struct region;
+    struct faction;
+    struct unit;
 
-  extern struct trigger_type tt_createunit;
+    extern struct trigger_type tt_createunit;
 
-  extern struct trigger *trigger_createunit(struct region *r, struct faction *f,
-    const struct race *rc, int number);
+    struct trigger *trigger_createunit(struct region *r, struct faction *f,
+        const struct race *rc, int number);
 
 #ifdef __cplusplus
 }
diff --git a/src/triggers/gate.c b/src/triggers/gate.c
index 0c284c3be..44d26e0ef 100644
--- a/src/triggers/gate.c
+++ b/src/triggers/gate.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/*
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -6,9 +6,9 @@
  |                   |  Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
  +-------------------+  Stefan Reich <reich@halbling.de>
 
- This program may not be used, modified or distributed 
+ This program may not be used, modified or distributed
  without prior permission by the authors of Eressea.
-*/
+ */
 #include <platform.h>
 #include <kernel/config.h>
 #include "gate.h"
@@ -31,87 +31,88 @@
 #include <stdlib.h>
 
 typedef struct gate_data {
-  struct building *gate;
-  struct region *target;
+    struct building *gate;
+    struct region *target;
 } gate_data;
 
 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;
+    /* 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;
+    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;
+    else {
+        log_error("could not perform gate::handle()\n");
+        return -1;
+    }
+    unused_arg(data);
+    return 0;
 }
 
 static void gate_write(const trigger * t, struct storage *store)
 {
-  gate_data *gd = (gate_data *) t->data.v;
-  building *b = gd->gate;
-  region *r = gd->target;
+    gate_data *gd = (gate_data *)t->data.v;
+    building *b = gd->gate;
+    region *r = gd->target;
 
-  write_building_reference(b, store);
-  write_region_reference(r, store);
+    write_building_reference(b, store);
+    write_region_reference(r, store);
 }
 
 static int gate_read(trigger * t, struct storage *store)
 {
-  gate_data *gd = (gate_data *) t->data.v;
+    gate_data *gd = (gate_data *)t->data.v;
 
-  int bc =
-    read_reference(&gd->gate, store, read_building_reference, resolve_building);
-  int rc =
-    read_reference(&gd->target, store, read_region_reference,
-    RESOLVE_REGION(global.data_version));
+    int bc =
+        read_reference(&gd->gate, store, read_building_reference, resolve_building);
+    int rc =
+        read_reference(&gd->target, store, read_region_reference,
+        RESOLVE_REGION(global.data_version));
 
-  if (bc == 0 && rc == 0) {
-    if (!gd->gate || !gd->target)
-      return AT_READ_FAIL;
-  }
-  return AT_READ_OK;
+    if (bc == 0 && rc == 0) {
+        if (!gd->gate || !gd->target)
+            return AT_READ_FAIL;
+    }
+    return AT_READ_OK;
 }
 
 static void gate_init(trigger * t)
 {
-  t->data.v = calloc(sizeof(gate_data), 1);
+    t->data.v = calloc(sizeof(gate_data), 1);
 }
 
 static void gate_done(trigger * t)
 {
-  free(t->data.v);
+    free(t->data.v);
 }
 
 struct trigger_type tt_gate = {
-  "gate",
-  gate_init,
-  gate_done,
-  gate_handle,
-  gate_write,
-  gate_read
+    "gate",
+    gate_init,
+    gate_done,
+    gate_handle,
+    gate_write,
+    gate_read
 };
 
 trigger *trigger_gate(building * b, region * target)
 {
-  trigger *t = t_new(&tt_gate);
-  gate_data *td = (gate_data *) t->data.v;
-  td->gate = b;
-  td->target = target;
-  return t;
+    trigger *t = t_new(&tt_gate);
+    gate_data *td = (gate_data *)t->data.v;
+    td->gate = b;
+    td->target = target;
+    return t;
 }
diff --git a/src/triggers/gate.h b/src/triggers/gate.h
index 6e80effba..ab90c50ff 100644
--- a/src/triggers/gate.h
+++ b/src/triggers/gate.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/*
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -6,9 +6,9 @@
  |                   |  Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
  +-------------------+  Stefan Reich <reich@halbling.de>
 
- This program may not be used, modified or distributed 
+ This program may not be used, modified or distributed
  without prior permission by the authors of Eressea.
-*/
+ */
 
 #ifndef GATE_H
 #define GATE_H
@@ -16,15 +16,15 @@
 extern "C" {
 #endif
 
-/* all types we use are defined here to reduce dependencies */
-  struct trigger_type;
-  struct trigger;
-  struct region;
-  struct building;
+    /* all types we use are defined here to reduce dependencies */
+    struct trigger_type;
+    struct trigger;
+    struct region;
+    struct building;
 
-  extern struct trigger_type tt_gate;
+    extern struct trigger_type tt_gate;
 
-  extern struct trigger *trigger_gate(struct building *b, struct region *r);
+    struct trigger *trigger_gate(struct building *b, struct region *r);
 
 #ifdef __cplusplus
 }
diff --git a/src/triggers/giveitem.c b/src/triggers/giveitem.c
index 3ed044617..787dd425d 100644
--- a/src/triggers/giveitem.c
+++ b/src/triggers/giveitem.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -43,77 +43,78 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  **/
 
 typedef struct giveitem_data {
-  struct unit *u;
-  const struct item_type *itype;
-  int number;
+    struct unit *u;
+    const struct item_type *itype;
+    int number;
 } giveitem_data;
 
 static void giveitem_init(trigger * t)
 {
-  t->data.v = calloc(sizeof(giveitem_data), 1);
+    t->data.v = calloc(sizeof(giveitem_data), 1);
 }
 
 static void giveitem_free(trigger * t)
 {
-  free(t->data.v);
+    free(t->data.v);
 }
 
 static int giveitem_handle(trigger * t, void *data)
 {
-  /* call an event handler on giveitem.
-   * data.v -> ( variant event, int timer )
-   */
-  giveitem_data *td = (giveitem_data *) t->data.v;
-  if (td->u && td->u->number) {
-    i_change(&td->u->items, td->itype, td->number);
-  } else {
-    log_error("could not perform giveitem::handle()\n");
-  }
-  unused_arg(data);
-  return 0;
+    /* call an event handler on giveitem.
+     * data.v -> ( variant event, int timer )
+     */
+    giveitem_data *td = (giveitem_data *)t->data.v;
+    if (td->u && td->u->number) {
+        i_change(&td->u->items, td->itype, td->number);
+    }
+    else {
+        log_error("could not perform giveitem::handle()\n");
+    }
+    unused_arg(data);
+    return 0;
 }
 
 static void giveitem_write(const trigger * t, struct storage *store)
 {
-  giveitem_data *td = (giveitem_data *) t->data.v;
-  write_unit_reference(td->u, store);
-  WRITE_INT(store, td->number);
-  WRITE_TOK(store, td->itype->rtype->_name);
+    giveitem_data *td = (giveitem_data *)t->data.v;
+    write_unit_reference(td->u, store);
+    WRITE_INT(store, td->number);
+    WRITE_TOK(store, td->itype->rtype->_name);
 }
 
 static int giveitem_read(trigger * t, struct storage *store)
 {
-  giveitem_data *td = (giveitem_data *) t->data.v;
-  char zText[128];
+    giveitem_data *td = (giveitem_data *)t->data.v;
+    char zText[128];
 
-  int result = read_reference(&td->u, store, read_unit_reference, resolve_unit);
+    int result = read_reference(&td->u, store, read_unit_reference, resolve_unit);
 
-  READ_INT(store, &td->number);
-  READ_TOK(store, zText, sizeof(zText));
-  td->itype = it_find(zText);
-  assert(td->itype);
+    READ_INT(store, &td->number);
+    READ_TOK(store, zText, sizeof(zText));
+    td->itype = it_find(zText);
+    assert(td->itype);
 
-  if (result == 0 && td->u == NULL) {
-    return AT_READ_FAIL;
-  }
-  return AT_READ_OK;
+    if (result == 0 && td->u == NULL) {
+        return AT_READ_FAIL;
+    }
+    return AT_READ_OK;
 }
 
 trigger_type tt_giveitem = {
-  "giveitem",
-  giveitem_init,
-  giveitem_free,
-  giveitem_handle,
-  giveitem_write,
-  giveitem_read
+    "giveitem",
+    giveitem_init,
+    giveitem_free,
+    giveitem_handle,
+    giveitem_write,
+    giveitem_read
 };
 
 trigger *trigger_giveitem(unit * u, const item_type * itype, int number)
 {
-  trigger *t = t_new(&tt_giveitem);
-  giveitem_data *td = (giveitem_data *) t->data.v;
-  td->number = number;
-  td->u = u;
-  td->itype = itype;
-  return t;
+    trigger *t = t_new(&tt_giveitem);
+    giveitem_data *td = (giveitem_data *)t->data.v;
+    td->number = number;
+    td->u = u;
+    td->itype = itype;
+    return t;
 }
diff --git a/src/triggers/giveitem.h b/src/triggers/giveitem.h
index 0bf1f3293..fef1e18f3 100644
--- a/src/triggers/giveitem.h
+++ b/src/triggers/giveitem.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,16 +22,16 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-/* all types we use are defined here to reduce dependencies */
-  struct trigger_type;
-  struct trigger;
-  struct unit;
-  struct item_type;
+    /* all types we use are defined here to reduce dependencies */
+    struct trigger_type;
+    struct trigger;
+    struct unit;
+    struct item_type;
 
-  extern struct trigger_type tt_giveitem;
+    extern struct trigger_type tt_giveitem;
 
-  extern struct trigger *trigger_giveitem(struct unit *mage,
-    const struct item_type *itype, int number);
+    struct trigger *trigger_giveitem(struct unit *mage,
+        const struct item_type *itype, int number);
 
 #ifdef __cplusplus
 }
diff --git a/src/triggers/killunit.c b/src/triggers/killunit.c
index 3376d9cc1..49b7a4931 100644
--- a/src/triggers/killunit.c
+++ b/src/triggers/killunit.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -40,46 +40,46 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 static int killunit_handle(trigger * t, void *data)
 {
-  /* call an event handler on killunit.
-   * data.v -> ( variant event, int timer )
-   */
-  unit *u = (unit *) t->data.v;
-  if (u) {
-    /* we can't remove_unit() here, because that's what's calling us. */
-    set_number(u, 0);
-  }
-  unused_arg(data);
-  return 0;
+    /* call an event handler on killunit.
+     * data.v -> ( variant event, int timer )
+     */
+    unit *u = (unit *)t->data.v;
+    if (u) {
+        /* we can't remove_unit() here, because that's what's calling us. */
+        set_number(u, 0);
+    }
+    unused_arg(data);
+    return 0;
 }
 
 static void killunit_write(const trigger * t, struct storage *store)
 {
-  unit *u = (unit *) t->data.v;
-  write_unit_reference(u, store);
+    unit *u = (unit *)t->data.v;
+    write_unit_reference(u, store);
 }
 
 static int killunit_read(trigger * t, struct storage *store)
 {
-  int result =
-    read_reference(&t->data.v, store, read_unit_reference, resolve_unit);
-  if (result == 0 && t->data.v == NULL) {
-    return AT_READ_FAIL;
-  }
-  return AT_READ_OK;
+    int result =
+        read_reference(&t->data.v, store, read_unit_reference, resolve_unit);
+    if (result == 0 && t->data.v == NULL) {
+        return AT_READ_FAIL;
+    }
+    return AT_READ_OK;
 }
 
 trigger_type tt_killunit = {
-  "killunit",
-  NULL,
-  NULL,
-  killunit_handle,
-  killunit_write,
-  killunit_read
+    "killunit",
+    NULL,
+    NULL,
+    killunit_handle,
+    killunit_write,
+    killunit_read
 };
 
 trigger *trigger_killunit(unit * u)
 {
-  trigger *t = t_new(&tt_killunit);
-  t->data.v = (void *)u;
-  return t;
+    trigger *t = t_new(&tt_killunit);
+    t->data.v = (void *)u;
+    return t;
 }
diff --git a/src/triggers/killunit.h b/src/triggers/killunit.h
index 548e85093..39f4b4877 100644
--- a/src/triggers/killunit.h
+++ b/src/triggers/killunit.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,13 +22,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  struct trigger_type;
-  struct trigger;
+    struct trigger_type;
+    struct trigger;
 
-  struct unit;
+    struct unit;
 
-  extern struct trigger_type tt_killunit;
-  extern struct trigger *trigger_killunit(struct unit *u);
+    extern struct trigger_type tt_killunit;
+    extern struct trigger *trigger_killunit(struct unit *u);
 
 #ifdef __cplusplus
 }
diff --git a/src/triggers/removecurse.c b/src/triggers/removecurse.c
index 38cdbc989..a8212cf78 100644
--- a/src/triggers/removecurse.c
+++ b/src/triggers/removecurse.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2014, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/triggers/removecurse.h b/src/triggers/removecurse.h
index e531d65a6..78028a2c7 100644
--- a/src/triggers/removecurse.h
+++ b/src/triggers/removecurse.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,16 +22,16 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-/* all types we use are defined here to reduce dependencies */
-  struct trigger_type;
-  struct trigger;
+    /* all types we use are defined here to reduce dependencies */
+    struct trigger_type;
+    struct trigger;
 
-  struct unit;
-  struct curse;
+    struct unit;
+    struct curse;
 
-  extern struct trigger_type tt_removecurse;
+    extern struct trigger_type tt_removecurse;
 
-  extern struct trigger *trigger_removecurse(struct curse *c,
+    extern struct trigger *trigger_removecurse(struct curse *c,
     struct unit *target);
 
 #ifdef __cplusplus
diff --git a/src/triggers/shock.c b/src/triggers/shock.c
index 09c3d488c..25bd71286 100644
--- a/src/triggers/shock.c
+++ b/src/triggers/shock.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -55,92 +55,93 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 static void do_shock(unit * u, const char *reason)
 {
-  int i;
+    int i;
 
-  if (u->number > 0) {
-    /* HP - Verlust */
-    u->hp = (unit_max_hp(u) * u->number) / 10;
-    u->hp = _max(1, u->hp);
-  }
-
-  /* Aura - Verlust */
-  if (is_mage(u)) {
-    set_spellpoints(u, max_spellpoints(u->region, u) / 10);
-  }
-
-  /* Evt. Talenttageverlust */
-  for (i = 0; i != u->skill_size; ++i)
-    if (rng_int() % 5 == 0) {
-      skill *sv = u->skills + i;
-      int weeks = (sv->level * sv->level - sv->level) / 2;
-      int change = (weeks + 9) / 10;
-      reduce_skill(u, sv, change);
+    if (u->number > 0) {
+        /* HP - Verlust */
+        u->hp = (unit_max_hp(u) * u->number) / 10;
+        u->hp = _max(1, u->hp);
     }
 
-  /* Dies ist ein Hack, um das skillmod und familiar-Attribut beim Mage
-   * zu l�schen wenn der Familiar get�tet wird. Da sollten wir �ber eine
-   * saubere Implementation nachdenken. */
+    /* Aura - Verlust */
+    if (is_mage(u)) {
+        set_spellpoints(u, max_spellpoints(u->region, u) / 10);
+    }
 
-  if (strcmp(reason, "trigger") == 0) {
-    remove_familiar(u);
-  }
-  if (u->faction != NULL) {
-    ADDMSG(&u->faction->msgs, msg_message("shock",
-        "mage reason", u, _strdup(reason)));
-  }
+    /* Evt. Talenttageverlust */
+    for (i = 0; i != u->skill_size; ++i)
+        if (rng_int() % 5 == 0) {
+            skill *sv = u->skills + i;
+            int weeks = (sv->level * sv->level - sv->level) / 2;
+            int change = (weeks + 9) / 10;
+            reduce_skill(u, sv, change);
+        }
+
+    /* Dies ist ein Hack, um das skillmod und familiar-Attribut beim Mage
+     * zu l�schen wenn der Familiar get�tet wird. Da sollten wir �ber eine
+     * saubere Implementation nachdenken. */
+
+    if (strcmp(reason, "trigger") == 0) {
+        remove_familiar(u);
+    }
+    if (u->faction != NULL) {
+        ADDMSG(&u->faction->msgs, msg_message("shock",
+            "mage reason", u, _strdup(reason)));
+    }
 }
 
 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;
+    /* destroy the unit */
+    unit *u = (unit *)t->data.v;
+    if (u && u->number) {
+        do_shock(u, "trigger");
+    }
+    unused_arg(data);
+    return 0;
 }
 
 static void shock_write(const trigger * t, struct storage *store)
 {
-  unit *u = (unit *) t->data.v;
-  trigger *next = t->next;
-  while (next) {
-    /* make sure it is unique! */
-    if (next->type == t->type && next->data.v == t->data.v)
-      break;
-    next = next->next;
-  }
-  if (next && u) {
-    log_error("more than one shock-attribut for %s on a unit. FIXED.\n", unitid(u));
-    write_unit_reference(NULL, store);
-  } else {
-    write_unit_reference(u, store);
-  }
+    unit *u = (unit *)t->data.v;
+    trigger *next = t->next;
+    while (next) {
+        /* make sure it is unique! */
+        if (next->type == t->type && next->data.v == t->data.v)
+            break;
+        next = next->next;
+    }
+    if (next && u) {
+        log_error("more than one shock-attribut for %s on a unit. FIXED.\n", unitid(u));
+        write_unit_reference(NULL, store);
+    }
+    else {
+        write_unit_reference(u, store);
+    }
 }
 
 static int shock_read(trigger * t, struct storage *store)
 {
-  int result =
-    read_reference(&t->data.v, store, read_unit_reference, resolve_unit);
-  if (result == 0 && t->data.v == NULL) {
-    return AT_READ_FAIL;
-  }
-  return AT_READ_OK;
+    int result =
+        read_reference(&t->data.v, store, read_unit_reference, resolve_unit);
+    if (result == 0 && t->data.v == NULL) {
+        return AT_READ_FAIL;
+    }
+    return AT_READ_OK;
 }
 
 trigger_type tt_shock = {
-  "shock",
-  NULL,
-  NULL,
-  shock_handle,
-  shock_write,
-  shock_read
+    "shock",
+    NULL,
+    NULL,
+    shock_handle,
+    shock_write,
+    shock_read
 };
 
 trigger *trigger_shock(unit * u)
 {
-  trigger *t = t_new(&tt_shock);
-  t->data.v = (void *)u;
-  return t;
+    trigger *t = t_new(&tt_shock);
+    t->data.v = (void *)u;
+    return t;
 }
diff --git a/src/triggers/shock.h b/src/triggers/shock.h
index 2c0e4fb27..b049db423 100644
--- a/src/triggers/shock.h
+++ b/src/triggers/shock.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,13 +22,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  struct trigger_type;
-  struct trigger;
+    struct trigger_type;
+    struct trigger;
 
-  struct unit;
+    struct unit;
 
-  extern struct trigger_type tt_shock;
-  extern struct trigger *trigger_shock(struct unit *u);
+    extern struct trigger_type tt_shock;
+    extern struct trigger *trigger_shock(struct unit *u);
 
 #ifdef __cplusplus
 }
diff --git a/src/triggers/timeout.c b/src/triggers/timeout.c
index 1a336f602..4a13f9668 100644
--- a/src/triggers/timeout.c
+++ b/src/triggers/timeout.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -34,76 +34,76 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  **/
 
 typedef struct timeout_data {
-  trigger *triggers;
-  int timer;
-  variant trigger_data;
+    trigger *triggers;
+    int timer;
+    variant trigger_data;
 } timeout_data;
 
 static void timeout_init(trigger * t)
 {
-  t->data.v = calloc(sizeof(timeout_data), 1);
+    t->data.v = calloc(sizeof(timeout_data), 1);
 }
 
 static void timeout_free(trigger * t)
 {
-  timeout_data *td = (timeout_data *) t->data.v;
-  free_triggers(td->triggers);
-  free(t->data.v);
+    timeout_data *td = (timeout_data *)t->data.v;
+    free_triggers(td->triggers);
+    free(t->data.v);
 }
 
 static int timeout_handle(trigger * t, void *data)
 {
-  /* call an event handler on timeout.
-   * data.v -> ( variant event, int timer )
-   */
-  timeout_data *td = (timeout_data *) t->data.v;
-  if (--td->timer == 0) {
-    handle_triggers(&td->triggers, NULL);
-    return -1;
-  }
-  unused_arg(data);
-  return 0;
+    /* call an event handler on timeout.
+     * data.v -> ( variant event, int timer )
+     */
+    timeout_data *td = (timeout_data *)t->data.v;
+    if (--td->timer == 0) {
+        handle_triggers(&td->triggers, NULL);
+        return -1;
+    }
+    unused_arg(data);
+    return 0;
 }
 
 static void timeout_write(const trigger * t, struct storage *store)
 {
-  timeout_data *td = (timeout_data *) t->data.v;
-  WRITE_INT(store, td->timer);
-  write_triggers(store, td->triggers);
+    timeout_data *td = (timeout_data *)t->data.v;
+    WRITE_INT(store, td->timer);
+    write_triggers(store, td->triggers);
 }
 
 static int timeout_read(trigger * t, struct storage *store)
 {
-  timeout_data *td = (timeout_data *) t->data.v;
-  READ_INT(store, &td->timer);
-  read_triggers(store, &td->triggers);
-  if (td->timer > 20) {
-    trigger *tr = td->triggers;
-    log_warning("there is a timeout lasting for another %d turns\n", td->timer);
-    while (tr) {
-      log_warning("  timeout triggers: %s\n", tr->type->name);
-      tr = tr->next;
+    timeout_data *td = (timeout_data *)t->data.v;
+    READ_INT(store, &td->timer);
+    read_triggers(store, &td->triggers);
+    if (td->timer > 20) {
+        trigger *tr = td->triggers;
+        log_warning("there is a timeout lasting for another %d turns\n", td->timer);
+        while (tr) {
+            log_warning("  timeout triggers: %s\n", tr->type->name);
+            tr = tr->next;
+        }
     }
-  }
-  if (td->triggers != NULL && td->timer > 0)
-    return AT_READ_OK;
-  return AT_READ_FAIL;
+    if (td->triggers != NULL && td->timer > 0)
+        return AT_READ_OK;
+    return AT_READ_FAIL;
 }
 
 trigger_type tt_timeout = {
-  "timeout",
-  timeout_init,
-  timeout_free,
-  timeout_handle,
-  timeout_write,
-  timeout_read
+    "timeout",
+    timeout_init,
+    timeout_free,
+    timeout_handle,
+    timeout_write,
+    timeout_read
 };
 
 trigger *trigger_timeout(int time, trigger * callbacks)
 {
-  trigger *t = t_new(&tt_timeout);
-  timeout_data *td = (timeout_data *) t->data.v;
-  td->triggers = callbacks;
-  td->timer = time;
-  return t;
+    trigger *t = t_new(&tt_timeout);
+    timeout_data *td = (timeout_data *)t->data.v;
+    td->triggers = callbacks;
+    td->timer = time;
+    return t;
 }
diff --git a/src/triggers/timeout.h b/src/triggers/timeout.h
index 4dc7ab07e..a690b3c7f 100644
--- a/src/triggers/timeout.h
+++ b/src/triggers/timeout.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,12 +22,12 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  struct trigger_type;
-  struct trigger;
+    struct trigger_type;
+    struct trigger;
 
-  extern struct trigger_type tt_timeout;
+    extern struct trigger_type tt_timeout;
 
-  extern struct trigger *trigger_timeout(int time, struct trigger *callbacks);
+    extern struct trigger *trigger_timeout(int time, struct trigger *callbacks);
 
 #ifdef __cplusplus
 }
diff --git a/src/triggers/triggers.c b/src/triggers/triggers.c
index ac9ccca95..95051bc12 100644
--- a/src/triggers/triggers.c
+++ b/src/triggers/triggers.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -42,19 +42,19 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 void register_triggers(void)
 {
-  if (verbosity >= 2)
-    printf("- registering triggers\n");
-  tt_register(&tt_changefaction);
-  tt_register(&tt_changerace);
-  tt_register(&tt_createcurse);
-  tt_register(&tt_createunit);
-  tt_register(&tt_gate);
-  tt_register(&tt_unguard);
-  tt_register(&tt_giveitem);
-  tt_register(&tt_killunit);
-  tt_register(&tt_removecurse);
-  tt_register(&tt_shock);
-  tt_register(&tt_unitmessage);
-  tt_register(&tt_timeout);
-  tt_register(&tt_clonedied);
+    if (verbosity >= 2)
+        printf("- registering triggers\n");
+    tt_register(&tt_changefaction);
+    tt_register(&tt_changerace);
+    tt_register(&tt_createcurse);
+    tt_register(&tt_createunit);
+    tt_register(&tt_gate);
+    tt_register(&tt_unguard);
+    tt_register(&tt_giveitem);
+    tt_register(&tt_killunit);
+    tt_register(&tt_removecurse);
+    tt_register(&tt_shock);
+    tt_register(&tt_unitmessage);
+    tt_register(&tt_timeout);
+    tt_register(&tt_clonedied);
 }
diff --git a/src/triggers/triggers.h b/src/triggers/triggers.h
index c17f75d71..660aedf6a 100644
--- a/src/triggers/triggers.h
+++ b/src/triggers/triggers.h
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
                          Katja Zedel <katze@felidae.kn-bremen.de
                          Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/triggers/unguard.c b/src/triggers/unguard.c
index f31d32ece..49cb6fe25 100644
--- a/src/triggers/unguard.c
+++ b/src/triggers/unguard.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -6,9 +6,9 @@
  |                   |  Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
  +-------------------+  Stefan Reich <reich@halbling.de>
 
- This program may not be used, modified or distributed 
+ This program may not be used, modified or distributed
  without prior permission by the authors of Eressea.
-*/
+ */
 #include <platform.h>
 #include <kernel/config.h>
 #include "unguard.h"
@@ -30,46 +30,47 @@
 
 static int unguard_handle(trigger * t, void *data)
 {
-  building *b = (building *) t->data.v;
+    building *b = (building *)t->data.v;
 
-  if (b) {
-    fset(b, BLD_UNGUARDED);
-  } else {
-    log_error("could not perform unguard::handle()\n");
-    return -1;
-  }
-  unused_arg(data);
-  return 0;
+    if (b) {
+        fset(b, BLD_UNGUARDED);
+    }
+    else {
+        log_error("could not perform unguard::handle()\n");
+        return -1;
+    }
+    unused_arg(data);
+    return 0;
 }
 
 static void unguard_write(const trigger * t, struct storage *store)
 {
-  write_building_reference((building *) t->data.v, store);
+    write_building_reference((building *)t->data.v, store);
 }
 
 static int unguard_read(trigger * t, struct storage *store)
 {
-  int rb =
-    read_reference(&t->data.v, store, read_building_reference,
-    resolve_building);
-  if (rb == 0 && !t->data.v) {
-    return AT_READ_FAIL;
-  }
-  return AT_READ_OK;
+    int rb =
+        read_reference(&t->data.v, store, read_building_reference,
+        resolve_building);
+    if (rb == 0 && !t->data.v) {
+        return AT_READ_FAIL;
+    }
+    return AT_READ_OK;
 }
 
 struct trigger_type tt_unguard = {
-  "building",
-  NULL,
-  NULL,
-  unguard_handle,
-  unguard_write,
-  unguard_read
+    "building",
+    NULL,
+    NULL,
+    unguard_handle,
+    unguard_write,
+    unguard_read
 };
 
 trigger *trigger_unguard(building * b)
 {
-  trigger *t = t_new(&tt_unguard);
-  t->data.v = (void *)b;
-  return t;
+    trigger *t = t_new(&tt_unguard);
+    t->data.v = (void *)b;
+    return t;
 }
diff --git a/src/triggers/unguard.h b/src/triggers/unguard.h
index 691ea761b..f36f527f8 100644
--- a/src/triggers/unguard.h
+++ b/src/triggers/unguard.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
diff --git a/src/triggers/unitmessage.c b/src/triggers/unitmessage.c
index 764c9cda0..df227ed24 100644
--- a/src/triggers/unitmessage.c
+++ b/src/triggers/unitmessage.c
@@ -1,9 +1,9 @@
-/* vi: set ts=2:
+/* 
 +-------------------+  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Christian Schlittchen <corwin@amber.kn-bremen.de>
 | (c) 1998 - 2008   |  Katja Zedel <katze@felidae.kn-bremen.de>
-+-------------------+  
-This program may not be used, modified or distributed 
++-------------------+
+This program may not be used, modified or distributed
 without prior permission by the authors of Eressea.
 */
 
@@ -38,87 +38,87 @@ without prior permission by the authors of Eressea.
 **/
 
 typedef struct unitmessage_data {
-  struct unit *target;
-  char *string;
-  int type;
-  int level;
+    struct unit *target;
+    char *string;
+    int type;
+    int level;
 } unitmessage_data;
 
 static void unitmessage_init(trigger * t)
 {
-  t->data.v = calloc(sizeof(unitmessage_data), 1);
+    t->data.v = calloc(sizeof(unitmessage_data), 1);
 }
 
 static void unitmessage_free(trigger * t)
 {
-  unitmessage_data *sd = (unitmessage_data *) t->data.v;
-  free(sd->string);
-  free(t->data.v);
+    unitmessage_data *sd = (unitmessage_data *)t->data.v;
+    free(sd->string);
+    free(t->data.v);
 }
 
 static int unitmessage_handle(trigger * t, void *data)
 {
-  /* call an event handler on unitmessage.
-   * data.v -> ( variant event, int timer )
-   */
-  unitmessage_data *td = (unitmessage_data *) t->data.v;
-  if (td->target && td->target->no) {
-    struct faction *f = td->target->faction;
-    const char * str = LOC(f->locale, td->string);
-    /* bug found in turn 733: sometimes, alps have f*cked up messages */
-    if (td->string && td->string[0]) {
-      addmessage(td->target->region, f, str, td->type,
-        td->level);
+    /* call an event handler on unitmessage.
+     * data.v -> ( variant event, int timer )
+     */
+    unitmessage_data *td = (unitmessage_data *)t->data.v;
+    if (td->target && td->target->no) {
+        struct faction *f = td->target->faction;
+        const char * str = LOC(f->locale, td->string);
+        /* bug found in turn 733: sometimes, alps have f*cked up messages */
+        if (td->string && td->string[0]) {
+            addmessage(td->target->region, f, str, td->type,
+                td->level);
+        }
     }
-  }
-  unused_arg(data);
-  return 0;
+    unused_arg(data);
+    return 0;
 }
 
 static void unitmessage_write(const trigger * t, struct storage *store)
 {
-  unitmessage_data *td = (unitmessage_data *) t->data.v;
-  write_unit_reference(td->target, store);
-  WRITE_TOK(store, td->string);
-  WRITE_INT(store, td->type);
-  WRITE_INT(store, td->level);
+    unitmessage_data *td = (unitmessage_data *)t->data.v;
+    write_unit_reference(td->target, store);
+    WRITE_TOK(store, td->string);
+    WRITE_INT(store, td->type);
+    WRITE_INT(store, td->level);
 }
 
 static int unitmessage_read(trigger * t, struct storage *store)
 {
-  unitmessage_data *td = (unitmessage_data *) t->data.v;
-  char zText[256];
+    unitmessage_data *td = (unitmessage_data *)t->data.v;
+    char zText[256];
 
-  int result =
-    read_reference(&td->target, store, read_unit_reference, resolve_unit);
-  READ_TOK(store, zText, sizeof(zText));
-  td->string = _strdup(zText);
-  READ_INT(store, &td->type);
-  READ_INT(store, &td->level);
+    int result =
+        read_reference(&td->target, store, read_unit_reference, resolve_unit);
+    READ_TOK(store, zText, sizeof(zText));
+    td->string = _strdup(zText);
+    READ_INT(store, &td->type);
+    READ_INT(store, &td->level);
 
-  if (result == 0 && td->target == NULL) {
-    return AT_READ_FAIL;
-  }
-  return AT_READ_OK;
+    if (result == 0 && td->target == NULL) {
+        return AT_READ_FAIL;
+    }
+    return AT_READ_OK;
 }
 
 trigger_type tt_unitmessage = {
-  "unitmessage",
-  unitmessage_init,
-  unitmessage_free,
-  unitmessage_handle,
-  unitmessage_write,
-  unitmessage_read
+    "unitmessage",
+    unitmessage_init,
+    unitmessage_free,
+    unitmessage_handle,
+    unitmessage_write,
+    unitmessage_read
 };
 
 trigger *trigger_unitmessage(unit * target, const char *string, int type,
-  int level)
+    int level)
 {
-  trigger *t = t_new(&tt_unitmessage);
-  unitmessage_data *td = (unitmessage_data *) t->data.v;
-  td->target = target;
-  td->string = _strdup(string);
-  td->type = type;
-  td->level = level;
-  return t;
+    trigger *t = t_new(&tt_unitmessage);
+    unitmessage_data *td = (unitmessage_data *)t->data.v;
+    td->target = target;
+    td->string = _strdup(string);
+    td->type = type;
+    td->level = level;
+    return t;
 }
diff --git a/src/triggers/unitmessage.h b/src/triggers/unitmessage.h
index 054a65b65..6b2f6f84c 100644
--- a/src/triggers/unitmessage.h
+++ b/src/triggers/unitmessage.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,14 +22,14 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-/* all types we use are defined here to reduce dependencies */
-  struct trigger_type;
-  struct trigger;
-  struct unit;
+    /* all types we use are defined here to reduce dependencies */
+    struct trigger_type;
+    struct trigger;
+    struct unit;
 
-  extern struct trigger_type tt_unitmessage;
-  extern struct trigger *trigger_unitmessage(struct unit *target,
-    const char *string, int type, int level);
+    extern struct trigger_type tt_unitmessage;
+    extern struct trigger *trigger_unitmessage(struct unit *target,
+        const char *string, int type, int level);
 
 #ifdef __cplusplus
 }
diff --git a/src/upkeep.test.c b/src/upkeep.test.c
index 893cf6b17..c7757624a 100644
--- a/src/upkeep.test.c
+++ b/src/upkeep.test.c
@@ -64,7 +64,7 @@ void test_upkeep_hunger_damage(CuTest * tc)
     u1->hp = 100;
     get_food(r);
     // since u1 and u2 are not allied, u1 should not help u2 with upkeep
-    CuAssertTrue(tc, u1->hp<100);
+    CuAssertTrue(tc, u1->hp < 100);
 
     test_cleanup();
 }
diff --git a/src/util/attrib.c b/src/util/attrib.c
index 5cf9957c6..f6bd61ec6 100644
--- a/src/util/attrib.c
+++ b/src/util/attrib.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
@@ -68,9 +68,9 @@ void at_register(attrib_type * at)
 static attrib_type *at_find(unsigned int hk)
 {
     const char *translate[3][2] = {
-            { "zielregion", "targetregion" },     /* remapping: from 'zielregion, heute targetregion */
-            { "verzaubert", "curse" },    /* remapping: fr�her verzaubert, jetzt curse */
-            { NULL, NULL }
+        { "zielregion", "targetregion" },     /* remapping: from 'zielregion, heute targetregion */
+        { "verzaubert", "curse" },    /* remapping: fr�her verzaubert, jetzt curse */
+        { NULL, NULL }
     };
     attrib_type *find = at_hash[hk % MAXATHASH];
     while (find && hk != find->hashkey)
diff --git a/src/util/attrib.h b/src/util/attrib.h
index 4c71f36f6..0791a4ffb 100644
--- a/src/util/attrib.h
+++ b/src/util/attrib.h
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/util/base36.c b/src/util/base36.c
index 58e521a78..541960aa3 100644
--- a/src/util/base36.c
+++ b/src/util/base36.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
@@ -79,7 +79,7 @@ const char *itoab(int i, int base)
             i = -i;
             neg = 1;
         }
-        while (i && dst>=s) {
+        while (i && dst >= s) {
             int x = i % base;
             i = i / base;
             if (x < 10) {
@@ -87,7 +87,7 @@ const char *itoab(int i, int base)
             }
             else if ('a' + x - 10 == 'l') {
                 *(dst--) = 'L';
-            } 
+            }
             else {
                 *(dst--) = (char)('a' + (x - 10));
             }
diff --git a/src/util/base36.h b/src/util/base36.h
index 67663a821..acaac8ce9 100644
--- a/src/util/base36.h
+++ b/src/util/base36.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,11 +22,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  extern int atoi36(const char *s);
-  extern const char *itoab(int i, int base);
-  extern const char *itoa36(int i);
-  extern const char *itoa10(int i);
-  extern int i10toi36(int i);
+    extern int atoi36(const char *s);
+    extern const char *itoab(int i, int base);
+    extern const char *itoa36(int i);
+    extern const char *itoa10(int i);
+    extern int i10toi36(int i);
 
 #ifdef __cplusplus
 }
diff --git a/src/util/bsdstring.c b/src/util/bsdstring.c
index 0f37ac71a..f1694eed6 100644
--- a/src/util/bsdstring.c
+++ b/src/util/bsdstring.c
@@ -9,48 +9,48 @@
 
 int wrptr(char **ptr, size_t * size, int bytes)
 {
-  if (bytes == 0) {
-    return 0;
-  }
-  if (bytes < 0) {
-    *size = 0;
-    return EINVAL;
-  }
-  if (bytes <= *(int *)size) {
-    *ptr += bytes;
-    *size -= bytes;
-    return 0;
-  }
+    if (bytes == 0) {
+        return 0;
+    }
+    if (bytes < 0) {
+        *size = 0;
+        return EINVAL;
+    }
+    if (bytes <= *(int *)size) {
+        *ptr += bytes;
+        *size -= bytes;
+        return 0;
+    }
 
-  *ptr += *size;
-  *size = 0;
-  return ENAMETOOLONG;
+    *ptr += *size;
+    *size = 0;
+    return ENAMETOOLONG;
 }
 
 #ifndef HAVE_STRLCPY
 #define HAVE_STRLCPY
 size_t strlcpy(char *dst, const char *src, size_t siz)
 {                               /* copied from OpenBSD source code */
-  register char *d = dst;
-  register const char *s = src;
-  register size_t n = siz;
+    register char *d = dst;
+    register const char *s = src;
+    register size_t n = siz;
 
-  /* Copy as many bytes as will fit */
-  if (n != 0 && --n != 0) {
-    do {
-      if ((*d++ = *s++) == 0)
-        break;
-    } while (--n != 0);
-  }
+    /* Copy as many bytes as will fit */
+    if (n != 0 && --n != 0) {
+        do {
+            if ((*d++ = *s++) == 0)
+                break;
+        } while (--n != 0);
+    }
 
-  /* Not enough room in dst, add NUL and traverse rest of src */
-  if (n == 0) {
-    if (siz != 0)
-      *d = '\0';                /* NUL-terminate dst */
-    while (*s++) ;
-  }
+    /* Not enough room in dst, add NUL and traverse rest of src */
+    if (n == 0) {
+        if (siz != 0)
+            *d = '\0';                /* NUL-terminate dst */
+        while (*s++);
+    }
 
-  return (s - src - 1);         /* count does not include NUL */
+    return (s - src - 1);         /* count does not include NUL */
 }
 #endif
 
@@ -58,29 +58,29 @@ size_t strlcpy(char *dst, const char *src, size_t siz)
 #define HAVE_STRLCAT
 size_t strlcat(char *dst, const char *src, size_t siz)
 {
-  register char *d = dst;
-  register const char *s = src;
-  register size_t n = siz;
-  size_t dlen;
+    register char *d = dst;
+    register const char *s = src;
+    register size_t n = siz;
+    size_t dlen;
 
-  /* Find the end of dst and adjust bytes left but don't go past end */
-  while (*d != '\0' && n-- != 0)
-    d++;
-  dlen = d - dst;
-  n = siz - dlen;
+    /* Find the end of dst and adjust bytes left but don't go past end */
+    while (*d != '\0' && n-- != 0)
+        d++;
+    dlen = d - dst;
+    n = siz - dlen;
 
-  if (n == 0)
-    return (dlen + strlen(s));
-  while (*s != '\0') {
-    if (n != 1) {
-      *d++ = *s;
-      n--;
+    if (n == 0)
+        return (dlen + strlen(s));
+    while (*s != '\0') {
+        if (n != 1) {
+            *d++ = *s;
+            n--;
+        }
+        s++;
     }
-    s++;
-  }
-  *d = '\0';
+    *d = '\0';
 
-  return (dlen + (s - src));    /* count does not include NUL */
+    return (dlen + (s - src));    /* count does not include NUL */
 }
 #endif
 
@@ -88,18 +88,18 @@ size_t strlcat(char *dst, const char *src, size_t siz)
 #define HAVE_SLPRINTF
 size_t slprintf(char * dst, size_t size, const char * format, ...)
 {
-  va_list args;
-  int result;
+    va_list args;
+    int result;
 
-  va_start(args, format);
-  result = vsnprintf(dst, size, format, args);
-  if (result<0 || result>=(int)size) {
-    dst[size-1]='\0';
-    return size;
-  }
-  va_start(args, format);
-  va_end(args);
+    va_start(args, format);
+    result = vsnprintf(dst, size, format, args);
+    if (result < 0 || result >= (int)size) {
+        dst[size - 1] = '\0';
+        return size;
+    }
+    va_start(args, format);
+    va_end(args);
 
-  return (size_t)result;
+    return (size_t)result;
 }
 #endif
diff --git a/src/util/bsdstring.test.c b/src/util/bsdstring.test.c
index 42423a766..f7ac97dd3 100644
--- a/src/util/bsdstring.test.c
+++ b/src/util/bsdstring.test.c
@@ -4,65 +4,65 @@
 
 static void test_strlcat(CuTest * tc)
 {
-  char buffer[32];
+    char buffer[32];
 
-  memset(buffer, 0x7f, sizeof(buffer));
+    memset(buffer, 0x7f, sizeof(buffer));
 
-  buffer[0] = '\0';
-  CuAssertIntEquals(tc, 4, strlcat(buffer, "herp", 4));
-  CuAssertStrEquals(tc, "her", buffer);
+    buffer[0] = '\0';
+    CuAssertIntEquals(tc, 4, strlcat(buffer, "herp", 4));
+    CuAssertStrEquals(tc, "her", buffer);
 
-  buffer[0] = '\0';
-  CuAssertIntEquals(tc, 4, strlcat(buffer, "herp", 8));
-  CuAssertStrEquals(tc, "herp", buffer);
-  CuAssertIntEquals(tc, 0x7f, buffer[5]);
+    buffer[0] = '\0';
+    CuAssertIntEquals(tc, 4, strlcat(buffer, "herp", 8));
+    CuAssertStrEquals(tc, "herp", buffer);
+    CuAssertIntEquals(tc, 0x7f, buffer[5]);
 
-  CuAssertIntEquals(tc, 8, strlcat(buffer, "derp", 8));
-  CuAssertStrEquals(tc, "herpder", buffer);
-  CuAssertIntEquals(tc, 0x7f, buffer[8]);
+    CuAssertIntEquals(tc, 8, strlcat(buffer, "derp", 8));
+    CuAssertStrEquals(tc, "herpder", buffer);
+    CuAssertIntEquals(tc, 0x7f, buffer[8]);
 }
 
 static void test_strlcpy(CuTest * tc)
 {
-  char buffer[32];
+    char buffer[32];
 
-  memset(buffer, 0x7f, sizeof(buffer));
+    memset(buffer, 0x7f, sizeof(buffer));
 
-  CuAssertIntEquals(tc, 4, strlcpy(buffer, "herp", 4));
-  CuAssertStrEquals(tc, "her", buffer);
+    CuAssertIntEquals(tc, 4, strlcpy(buffer, "herp", 4));
+    CuAssertStrEquals(tc, "her", buffer);
 
-  CuAssertIntEquals(tc, 4, strlcpy(buffer, "herp", 8));
-  CuAssertStrEquals(tc, "herp", buffer);
-  CuAssertIntEquals(tc, 0x7f, buffer[5]);
+    CuAssertIntEquals(tc, 4, strlcpy(buffer, "herp", 8));
+    CuAssertStrEquals(tc, "herp", buffer);
+    CuAssertIntEquals(tc, 0x7f, buffer[5]);
 
-  CuAssertIntEquals(tc, 8, strlcpy(buffer, "herpderp", 8));
-  CuAssertStrEquals(tc, "herpder", buffer);
-  CuAssertIntEquals(tc, 0x7f, buffer[8]);
+    CuAssertIntEquals(tc, 8, strlcpy(buffer, "herpderp", 8));
+    CuAssertStrEquals(tc, "herpder", buffer);
+    CuAssertIntEquals(tc, 0x7f, buffer[8]);
 }
 
 static void test_slprintf(CuTest * tc)
 {
-  char buffer[32];
+    char buffer[32];
 
-  memset(buffer, 0x7f, sizeof(buffer));
+    memset(buffer, 0x7f, sizeof(buffer));
 
-  CuAssertTrue(tc, slprintf(buffer, 4, "%s", "herpderp")>3);
-  CuAssertStrEquals(tc, "her", buffer);
+    CuAssertTrue(tc, slprintf(buffer, 4, "%s", "herpderp") > 3);
+    CuAssertStrEquals(tc, "her", buffer);
 
-  CuAssertIntEquals(tc, 4, slprintf(buffer, 8, "%s", "herp"));
-  CuAssertStrEquals(tc, "herp", buffer);
-  CuAssertIntEquals(tc, 0x7f, buffer[5]);
+    CuAssertIntEquals(tc, 4, slprintf(buffer, 8, "%s", "herp"));
+    CuAssertStrEquals(tc, "herp", buffer);
+    CuAssertIntEquals(tc, 0x7f, buffer[5]);
 
-  CuAssertIntEquals(tc, 8, slprintf(buffer, 8, "%s", "herpderp"));
-  CuAssertStrEquals(tc, "herpder", buffer);
-  CuAssertIntEquals(tc, 0x7f, buffer[8]);
+    CuAssertIntEquals(tc, 8, slprintf(buffer, 8, "%s", "herpderp"));
+    CuAssertStrEquals(tc, "herpder", buffer);
+    CuAssertIntEquals(tc, 0x7f, buffer[8]);
 }
 
 CuSuite *get_bsdstring_suite(void)
 {
-  CuSuite *suite = CuSuiteNew();
-  SUITE_ADD_TEST(suite, test_strlcat);
-  SUITE_ADD_TEST(suite, test_strlcpy);
-  SUITE_ADD_TEST(suite, test_slprintf);
-  return suite;
+    CuSuite *suite = CuSuiteNew();
+    SUITE_ADD_TEST(suite, test_strlcat);
+    SUITE_ADD_TEST(suite, test_strlcpy);
+    SUITE_ADD_TEST(suite, test_slprintf);
+    return suite;
 }
diff --git a/src/util/crmessage.c b/src/util/crmessage.c
index c6788751d..517adfd6e 100644
--- a/src/util/crmessage.c
+++ b/src/util/crmessage.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/*
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -9,7 +9,7 @@
  This program may not be used, modified or distributed
  without prior permission by the authors of Eressea.
 
-*/
+ */
 
 #include <platform.h>
 #include "crmessage.h"
@@ -25,46 +25,46 @@
 
 /** type to string conversion **/
 typedef struct tsf_list {
-  struct tsf_list *next;
-  const char *name;
-  tostring_f fun;
+    struct tsf_list *next;
+    const char *name;
+    tostring_f fun;
 } tsf_list;
 
 static tsf_list *tostringfs;
 
 static tostring_f tsf_find(const char *name)
 {
-  if (name != NULL) {
-    tsf_list *tsf;
-    for (tsf = tostringfs; tsf; tsf = tsf->next) {
-      if (!strcmp(tsf->name, name))
-        return tsf->fun;
+    if (name != NULL) {
+        tsf_list *tsf;
+        for (tsf = tostringfs; tsf; tsf = tsf->next) {
+            if (!strcmp(tsf->name, name))
+                return tsf->fun;
+        }
     }
-  }
-  return NULL;
+    return NULL;
 }
 
 void tsf_register(const char *name, tostring_f fun)
 {
-  tsf_list *tsf;
-  for (tsf = tostringfs; tsf; tsf = tsf->next) {
-    if (!strcmp(tsf->name, name))
-      break;
-  }
-  if (tsf == NULL) {
-    tsf = malloc(sizeof(tsf_list));
-    tsf->fun = fun;
-    tsf->name = name;
-    tsf->next = tostringfs;
-    tostringfs = tsf;
-  }
+    tsf_list *tsf;
+    for (tsf = tostringfs; tsf; tsf = tsf->next) {
+        if (!strcmp(tsf->name, name))
+            break;
+    }
+    if (tsf == NULL) {
+        tsf = malloc(sizeof(tsf_list));
+        tsf->fun = fun;
+        tsf->name = name;
+        tsf->next = tostringfs;
+        tostringfs = tsf;
+    }
 }
 
 /** crmesssage **/
 typedef struct crmessage_type {
-  const struct message_type *mtype;
-  tostring_f *renderers;
-  struct crmessage_type *next;
+    const struct message_type *mtype;
+    tostring_f *renderers;
+    struct crmessage_type *next;
 } crmessage_type;
 
 #define CRMAXHASH 63
@@ -72,84 +72,86 @@ static crmessage_type *crtypes[CRMAXHASH];
 
 static crmessage_type *crt_find(const struct message_type *mtype)
 {
-  unsigned int hash = hashstring(mtype->name) % CRMAXHASH;
-  crmessage_type *found = NULL;
-  crmessage_type *type = crtypes[hash];
-  while (type) {
-    if (type->mtype == mtype)
-      found = type;
-    type = type->next;
-  }
-  return found;
+    unsigned int hash = hashstring(mtype->name) % CRMAXHASH;
+    crmessage_type *found = NULL;
+    crmessage_type *type = crtypes[hash];
+    while (type) {
+        if (type->mtype == mtype)
+            found = type;
+        type = type->next;
+    }
+    return found;
 }
 
 void crt_register(const struct message_type *mtype)
 {
-  unsigned int hash = hashstring(mtype->name) % CRMAXHASH;
-  crmessage_type *crt = crtypes[hash];
-  while (crt && crt->mtype != mtype) {
-    crt = crt->next;
-  }
-  if (!crt) {
-    int i;
-    crt = malloc(sizeof(crmessage_type));
-    crt->mtype = mtype;
-    crt->next = crtypes[hash];
-    crtypes[hash] = crt;
-    if (mtype->nparameters > 0) {
-      crt->renderers = malloc(sizeof(tostring_f) * mtype->nparameters);
-    } else {
-      crt->renderers = NULL;
+    unsigned int hash = hashstring(mtype->name) % CRMAXHASH;
+    crmessage_type *crt = crtypes[hash];
+    while (crt && crt->mtype != mtype) {
+        crt = crt->next;
     }
+    if (!crt) {
+        int i;
+        crt = malloc(sizeof(crmessage_type));
+        crt->mtype = mtype;
+        crt->next = crtypes[hash];
+        crtypes[hash] = crt;
+        if (mtype->nparameters > 0) {
+            crt->renderers = malloc(sizeof(tostring_f) * mtype->nparameters);
+        }
+        else {
+            crt->renderers = NULL;
+        }
 
-    /* can be scrapped for memory vs. speed */
-    for (i = 0; i != mtype->nparameters; ++i) {
-      crt->renderers[i] = tsf_find(mtype->types[i]->name);
+        /* can be scrapped for memory vs. speed */
+        for (i = 0; i != mtype->nparameters; ++i) {
+            crt->renderers[i] = tsf_find(mtype->types[i]->name);
+        }
     }
-  }
 }
 
 int cr_render(const message * msg, char *buffer, const void *userdata)
 {
-  int i;
-  char *c = buffer;
-  struct crmessage_type *crt = crt_find(msg->type);
+    int i;
+    char *c = buffer;
+    struct crmessage_type *crt = crt_find(msg->type);
 
-  if (crt == NULL)
-    return -1;
-  for (i = 0; i != msg->type->nparameters; ++i) {
-    if (crt->renderers[i] == NULL) {
-      log_error("No renderer for argument %s:%s of \"%s\"\n", msg->type->pnames[i], msg->type->types[i]->name, msg->type->name);
-      continue;                 /* strcpy(c, (const char*)msg->locale_string(u->faction->locale, parameters[i])); */
-    } else {
-      if (crt->renderers[i] (msg->parameters[i], c, userdata) != 0)
-        continue;
+    if (crt == NULL)
+        return -1;
+    for (i = 0; i != msg->type->nparameters; ++i) {
+        if (crt->renderers[i] == NULL) {
+            log_error("No renderer for argument %s:%s of \"%s\"\n", msg->type->pnames[i], msg->type->types[i]->name, msg->type->name);
+            continue;                 /* strcpy(c, (const char*)msg->locale_string(u->faction->locale, parameters[i])); */
+        }
+        else {
+            if (crt->renderers[i](msg->parameters[i], c, userdata) != 0)
+                continue;
+        }
+        c += strlen(c);
+        sprintf(c, ";%s\n", msg->type->pnames[i]);
+        c += strlen(c);
     }
-    c += strlen(c);
-    sprintf(c, ";%s\n", msg->type->pnames[i]);
-    c += strlen(c);
-  }
-  return 0;
+    return 0;
 }
 
 int cr_string(variant var, char *buffer, const void *userdata)
 {
-  sprintf(buffer, "\"%s\"", (const char *)var.v);
-  unused_arg(userdata);
-  return 0;
+    sprintf(buffer, "\"%s\"", (const char *)var.v);
+    unused_arg(userdata);
+    return 0;
 }
 
 int cr_int(variant var, char *buffer, const void *userdata)
 {
-  sprintf(buffer, "%d", var.i);
-  unused_arg(userdata);
-  return 0;
+    sprintf(buffer, "%d", var.i);
+    unused_arg(userdata);
+    return 0;
 }
 
 int cr_ignore(variant var, char *buffer, const void *userdata)
 {
-  unused_arg(var);
-  unused_arg(buffer);
-  unused_arg(userdata);
-  return -1;
+    unused_arg(var);
+    unused_arg(buffer);
+    unused_arg(userdata);
+    return -1;
 }
diff --git a/src/util/crmessage.h b/src/util/crmessage.h
index c56e9a85c..be6b67367 100644
--- a/src/util/crmessage.h
+++ b/src/util/crmessage.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -6,9 +6,9 @@
  |                   |  Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
  +-------------------+  Stefan Reich <reich@halbling.de>
 
- This program may not be used, modified or distributed 
+ This program may not be used, modified or distributed
  without prior permission by the authors of Eressea.
-*/
+ */
 
 #ifndef H_UTIL_CRMESSAGE
 #define H_UTIL_CRMESSAGE
@@ -18,21 +18,21 @@
 extern "C" {
 #endif
 
-  struct locale;
-  struct message;
-  struct message_type;
+    struct locale;
+    struct message;
+    struct message_type;
 
-  typedef int (*tostring_f) (variant data, char *buffer, const void *userdata);
-  extern void tsf_register(const char *name, tostring_f fun);
-  /* registers a new type->string-function */
+    typedef int(*tostring_f) (variant data, char *buffer, const void *userdata);
+    void tsf_register(const char *name, tostring_f fun);
+    /* registers a new type->string-function */
 
-  extern int cr_string(variant v, char *buffer, const void *userdata);
-  extern int cr_int(variant v, char *buffer, const void *userdata);
-  extern int cr_ignore(variant v, char *buffer, const void *userdata);
+    int cr_string(variant v, char *buffer, const void *userdata);
+    int cr_int(variant v, char *buffer, const void *userdata);
+    int cr_ignore(variant v, char *buffer, const void *userdata);
 
-  extern void crt_register(const struct message_type *mtype);
-  extern int cr_render(const struct message *msg, char *buffer,
-    const void *userdata);
+    void crt_register(const struct message_type *mtype);
+    int cr_render(const struct message *msg, char *buffer,
+        const void *userdata);
 
 #ifdef __cplusplus
 }
diff --git a/src/util/dice.c b/src/util/dice.c
index 6549c33a8..557156c49 100644
--- a/src/util/dice.c
+++ b/src/util/dice.c
@@ -1,6 +1,4 @@
-/* vi: set ts=2:
- *
- *	
+/*
  *	Eressea PB(E)M host Copyright (C) 1998
  *		Enno Rehling (rehling@usa.net)
  *		Christian Schlittchen (corwin@amber.kn-bremen.de)
@@ -28,70 +26,74 @@
  * Usage: 3d6-3d4+5 = dice(3,6)-dice(3,4)+5 */
 int dice(int count, int value)
 {
-  int d = 0, c;
+    int d = 0, c;
 
-  if (value <= 0)
-    return 0;                   /* (enno) %0 geht nicht. echt wahr. */
-  if (count >= 0)
-    for (c = count; c > 0; c--)
-      d += rng_int() % value + 1;
-  else
-    for (c = count; c < 0; c++)
-      d -= rng_int() % value + 1;
+    if (value <= 0)
+        return 0;                   /* (enno) %0 geht nicht. echt wahr. */
+    if (count >= 0)
+        for (c = count; c > 0; c--)
+            d += rng_int() % value + 1;
+    else
+        for (c = count; c < 0; c++)
+            d -= rng_int() % value + 1;
 
-  return d;
+    return d;
 }
 
 static int term_eval(const char **sptr)
 {
-  const char *c = *sptr;
-  int m = 0, d = 0, k = 0, term = 1, multi = 1;
-  int state = 1;
+    const char *c = *sptr;
+    int m = 0, d = 0, k = 0, term = 1, multi = 1;
+    int state = 1;
 
-  for (;;) {
-    if (isdigit(*(unsigned char *)c)) {
-      k = k * 10 + (*c - '0');
-    } else if (*c == '+' || *c == '-' || *c == 0 || *c == '*' || *c == ')'
-      || *c == '(') {
-      if (state == 1)           /* konstante k addieren */
-        m += k * multi;
-      else if (state == 2) {    /* dDk */
-        int i;
-        if (k == 0)
-          k = 6;                /* 3d == 3d6 */
-        for (i = 0; i != d; ++i)
-          m += (1 + rng_int() % k) * multi;
-      } else
-        assert(!"dice_rand: illegal token");
-      if (*c == '*') {
-        term *= m;
-        m = 0;
-      }
-      k = d = 0;
-      state = 1;
-      multi = (*c == '-') ? -1 : 1;
+    for (;;) {
+        if (isdigit(*(unsigned char *)c)) {
+            k = k * 10 + (*c - '0');
+        }
+        else if (*c == '+' || *c == '-' || *c == 0 || *c == '*' || *c == ')'
+            || *c == '(') {
+            if (state == 1)           /* konstante k addieren */
+                m += k * multi;
+            else if (state == 2) {    /* dDk */
+                int i;
+                if (k == 0)
+                    k = 6;                /* 3d == 3d6 */
+                for (i = 0; i != d; ++i)
+                    m += (1 + rng_int() % k) * multi;
+            }
+            else
+                assert(!"dice_rand: illegal token");
+            if (*c == '*') {
+                term *= m;
+                m = 0;
+            }
+            k = d = 0;
+            state = 1;
+            multi = (*c == '-') ? -1 : 1;
 
-      if (*c == '(') {
-        ++c;
-        k = term_eval(&c);
-      } else if (*c == 0 || *c == ')') {
-        break;
-      }
-    } else if (*c == 'd' || *c == 'D') {
-      if (k == 0)
-        k = 1;                  /* d9 == 1d9 */
-      assert(state == 1 || !"dice_rand: illegal token");
-      d = k;
-      k = 0;
-      state = 2;
+            if (*c == '(') {
+                ++c;
+                k = term_eval(&c);
+            }
+            else if (*c == 0 || *c == ')') {
+                break;
+            }
+        }
+        else if (*c == 'd' || *c == 'D') {
+            if (k == 0)
+                k = 1;                  /* d9 == 1d9 */
+            assert(state == 1 || !"dice_rand: illegal token");
+            d = k;
+            k = 0;
+            state = 2;
+        }
+        c++;
     }
-    c++;
-  }
-  *sptr = c;
-  return m * term;
+    *sptr = c;
+    return m * term;
 }
 
 int dice_rand(const char *s)
 {
-  return term_eval(&s);
+    return term_eval(&s);
 }
diff --git a/src/util/event.c b/src/util/event.c
index a75eca6dd..1f801c3b2 100644
--- a/src/util/event.c
+++ b/src/util/event.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -32,83 +32,84 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 void write_triggers(struct storage *store, const trigger * t)
 {
-  while (t) {
-    if (t->type->write) {
-      WRITE_TOK(store, t->type->name);
-      t->type->write(t, store);
+    while (t) {
+        if (t->type->write) {
+            WRITE_TOK(store, t->type->name);
+            t->type->write(t, store);
+        }
+        t = t->next;
     }
-    t = t->next;
-  }
-  WRITE_TOK(store, "end");
+    WRITE_TOK(store, "end");
 }
 
 int read_triggers(struct storage *store, trigger ** tp)
 {
-  for (;;) {
-    trigger_type *ttype;
-    char zText[128];
+    for (;;) {
+        trigger_type *ttype;
+        char zText[128];
 
-    READ_TOK(store, zText, sizeof(zText));
-    if (!strcmp(zText, "end"))
-      break;
-    ttype = tt_find(zText);
-    assert(ttype || !"unknown trigger-type");
-    *tp = t_new(ttype);
-    if (ttype->read) {
-      int i = ttype->read(*tp, store);
-      switch (i) {
-        case AT_READ_OK:
-          tp = &(*tp)->next;
-          break;
-        case AT_READ_FAIL:
-          t_free(*tp);
-          *tp = NULL;
-          break;
-        default:
-          assert(!"invalid return value");
-          break;
-      }
+        READ_TOK(store, zText, sizeof(zText));
+        if (!strcmp(zText, "end"))
+            break;
+        ttype = tt_find(zText);
+        assert(ttype || !"unknown trigger-type");
+        *tp = t_new(ttype);
+        if (ttype->read) {
+            int i = ttype->read(*tp, store);
+            switch (i) {
+            case AT_READ_OK:
+                tp = &(*tp)->next;
+                break;
+            case AT_READ_FAIL:
+                t_free(*tp);
+                *tp = NULL;
+                break;
+            default:
+                assert(!"invalid return value");
+                break;
+            }
+        }
     }
-  }
-  return 0;
+    return 0;
 }
 
 trigger *t_new(trigger_type * ttype)
 {
-  trigger *t = calloc(sizeof(trigger), 1);
-  t->type = ttype;
-  if (ttype->initialize)
-    ttype->initialize(t);
-  return t;
+    trigger *t = calloc(sizeof(trigger), 1);
+    t->type = ttype;
+    if (ttype->initialize)
+        ttype->initialize(t);
+    return t;
 }
 
 void t_free(trigger * t)
 {
-  if (t->type->finalize)
-    t->type->finalize(t);
+    if (t->type->finalize)
+        t->type->finalize(t);
 }
 
 void free_triggers(trigger * triggers)
 {
-  while (triggers) {
-    trigger *t = triggers;
-    triggers = t->next;
-    t_free(t);
-  }
+    while (triggers) {
+        trigger *t = triggers;
+        triggers = t->next;
+        t_free(t);
+    }
 }
 
 int handle_triggers(trigger ** triggers, void *param)
 {
-  trigger **tp = triggers;
-  while (*tp) {
-    trigger *t = *tp;
-    if (t->type->handle(t, param) != 0) {
-      *tp = t->next;
-      t_free(t);
-    } else
-      tp = &t->next;
-  }
-  return (*triggers != NULL);
+    trigger **tp = triggers;
+    while (*tp) {
+        trigger *t = *tp;
+        if (t->type->handle(t, param) != 0) {
+            *tp = t->next;
+            t_free(t);
+        }
+        else
+            tp = &t->next;
+    }
+    return (*triggers != NULL);
 }
 
 /***
@@ -116,149 +117,150 @@ int handle_triggers(trigger ** triggers, void *param)
  **/
 
 typedef struct handler_info {
-  char *event;
-  trigger *triggers;
+    char *event;
+    trigger *triggers;
 } handler_info;
 
 static void init_handler(attrib * a)
 {
-  a->data.v = calloc(sizeof(handler_info), 1);
+    a->data.v = calloc(sizeof(handler_info), 1);
 }
 
 static void free_handler(attrib * a)
 {
-  handler_info *hi = (handler_info *) a->data.v;
-  free_triggers(hi->triggers);
-  free(hi->event);
-  free(hi);
+    handler_info *hi = (handler_info *)a->data.v;
+    free_triggers(hi->triggers);
+    free(hi->event);
+    free(hi);
 }
 
 static void
 write_handler(const attrib * a, const void *owner, struct storage *store)
 {
-  handler_info *hi = (handler_info *) a->data.v;
-  WRITE_TOK(store, hi->event);
-  write_triggers(store, hi->triggers);
+    handler_info *hi = (handler_info *)a->data.v;
+    WRITE_TOK(store, hi->event);
+    write_triggers(store, hi->triggers);
 }
 
 static int read_handler(attrib * a, void *owner, struct storage *store)
 {
-  char zText[128];
-  handler_info *hi = (handler_info *) a->data.v;
+    char zText[128];
+    handler_info *hi = (handler_info *)a->data.v;
 
-  READ_TOK(store, zText, sizeof(zText));
-  hi->event = _strdup(zText);
-  read_triggers(store, &hi->triggers);
-  if (hi->triggers != NULL) {
-    return AT_READ_OK;
-  }
-  return AT_READ_FAIL;
+    READ_TOK(store, zText, sizeof(zText));
+    hi->event = _strdup(zText);
+    read_triggers(store, &hi->triggers);
+    if (hi->triggers != NULL) {
+        return AT_READ_OK;
+    }
+    return AT_READ_FAIL;
 }
 
 attrib_type at_eventhandler = {
-  "eventhandler",
-  init_handler,
-  free_handler,
-  NULL,
-  write_handler,
-  read_handler
+    "eventhandler",
+    init_handler,
+    free_handler,
+    NULL,
+    write_handler,
+    read_handler
 };
 
 struct trigger **get_triggers(struct attrib *ap, const char *eventname)
 {
-  handler_info *td = NULL;
-  attrib *a = a_find(ap, &at_eventhandler);
-  while (a != NULL && a->type == &at_eventhandler) {
-    td = (handler_info *) a->data.v;
-    if (strcmp(td->event, eventname) == 0) {
-      return &td->triggers;
+    handler_info *td = NULL;
+    attrib *a = a_find(ap, &at_eventhandler);
+    while (a != NULL && a->type == &at_eventhandler) {
+        td = (handler_info *)a->data.v;
+        if (strcmp(td->event, eventname) == 0) {
+            return &td->triggers;
+        }
+        a = a->next;
     }
-    a = a->next;
-  }
-  return NULL;
+    return NULL;
 }
 
 void add_trigger(struct attrib **ap, const char *eventname, struct trigger *t)
 {
-  trigger **tp;
-  handler_info *td = NULL;
-  attrib *a = a_find(*ap, &at_eventhandler);
-  assert(t->next == NULL);
-  while (a != NULL && a->type == &at_eventhandler) {
-    td = (handler_info *) a->data.v;
-    if (!strcmp(td->event, eventname)) {
-      break;
+    trigger **tp;
+    handler_info *td = NULL;
+    attrib *a = a_find(*ap, &at_eventhandler);
+    assert(t->next == NULL);
+    while (a != NULL && a->type == &at_eventhandler) {
+        td = (handler_info *)a->data.v;
+        if (!strcmp(td->event, eventname)) {
+            break;
+        }
+        a = a->next;
     }
-    a = a->next;
-  }
-  if (a == NULL || a->type != &at_eventhandler) {
-    a = a_add(ap, a_new(&at_eventhandler));
-    td = (handler_info *) a->data.v;
-    td->event = _strdup(eventname);
-  }
-  tp = &td->triggers;
-  while (*tp)
-    tp = &(*tp)->next;
-  *tp = t;
+    if (a == NULL || a->type != &at_eventhandler) {
+        a = a_add(ap, a_new(&at_eventhandler));
+        td = (handler_info *)a->data.v;
+        td->event = _strdup(eventname);
+    }
+    tp = &td->triggers;
+    while (*tp)
+        tp = &(*tp)->next;
+    *tp = t;
 }
 
 void handle_event(attrib * attribs, const char *eventname, void *data)
 {
-  while (attribs) {
-    if (attribs->type == &at_eventhandler)
-      break;
-    attribs = attribs->nexttype;
-  }
-  while (attribs && attribs->type == &at_eventhandler) {
-    handler_info *tl = (handler_info *) attribs->data.v;
-    if (!strcmp(tl->event, eventname)) {
-      handler_info *tl = (handler_info *) attribs->data.v;
-      handle_triggers(&tl->triggers, data);
-      break;
+    while (attribs) {
+        if (attribs->type == &at_eventhandler)
+            break;
+        attribs = attribs->nexttype;
+    }
+    while (attribs && attribs->type == &at_eventhandler) {
+        handler_info *tl = (handler_info *)attribs->data.v;
+        if (!strcmp(tl->event, eventname)) {
+            handler_info *tl = (handler_info *)attribs->data.v;
+            handle_triggers(&tl->triggers, data);
+            break;
+        }
+        attribs = attribs->next;
     }
-    attribs = attribs->next;
-  }
 }
 
 void t_add(struct trigger **tlist, struct trigger *t)
 {
-  while (*tlist)
-    tlist = &(*tlist)->next;
-  *tlist = t;
+    while (*tlist)
+        tlist = &(*tlist)->next;
+    *tlist = t;
 }
 
 static trigger_type *triggertypes;
 
 void tt_register(trigger_type * tt)
 {
-  tt->next = triggertypes;
-  triggertypes = tt;
+    tt->next = triggertypes;
+    triggertypes = tt;
 }
 
 trigger_type *tt_find(const char *name)
 {
-  trigger_type *tt = triggertypes;
-  while (tt && strcmp(tt->name, name))
-    tt = tt->next;
-  return tt;
+    trigger_type *tt = triggertypes;
+    while (tt && strcmp(tt->name, name))
+        tt = tt->next;
+    return tt;
 }
 
 void
 remove_triggers(struct attrib **ap, const char *eventname,
-  const trigger_type * tt)
+const trigger_type * tt)
 {
-  trigger **tp = get_triggers(*ap, eventname);
-  if (tp == NULL)
-    return;
-  while (*tp) {
-    /* first, remove all gate-triggers */
-    trigger *t = *tp;
-    if (t->type == tt) {
-      *tp = t->next;
-      t_free(t);
-    } else
-      tp = &t->next;
-  }
+    trigger **tp = get_triggers(*ap, eventname);
+    if (tp == NULL)
+        return;
+    while (*tp) {
+        /* first, remove all gate-triggers */
+        trigger *t = *tp;
+        if (t->type == tt) {
+            *tp = t->next;
+            t_free(t);
+        }
+        else
+            tp = &t->next;
+    }
 }
 
 /***
diff --git a/src/util/event.h b/src/util/event.h
index ef230219c..d6b20f5df 100644
--- a/src/util/event.h
+++ b/src/util/event.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -24,59 +24,59 @@ extern "C" {
 
 #include "variant.h"
 
-  struct attrib;
-  struct trigger;
-  struct storage;
+    struct attrib;
+    struct trigger;
+    struct storage;
 
-  typedef struct trigger_type {
-    const char *name;
-    void (*initialize) (struct trigger *);
-    void (*finalize) (struct trigger *);
-    int (*handle) (struct trigger *, void *);
-    void (*write) (const struct trigger *, struct storage * store);
-    int (*read) (struct trigger *, struct storage * store);
+    typedef struct trigger_type {
+        const char *name;
+        void(*initialize) (struct trigger *);
+        void(*finalize) (struct trigger *);
+        int(*handle) (struct trigger *, void *);
+        void(*write) (const struct trigger *, struct storage * store);
+        int(*read) (struct trigger *, struct storage * store);
 
-    struct trigger_type *next;
-  } trigger_type;
+        struct trigger_type *next;
+    } trigger_type;
 
-  extern trigger_type *tt_find(const char *name);
-  extern void tt_register(trigger_type * ttype);
+    trigger_type *tt_find(const char *name);
+    void tt_register(trigger_type * ttype);
 
-  typedef struct trigger {
-    struct trigger_type *type;
-    struct trigger *next;
+    typedef struct trigger {
+        struct trigger_type *type;
+        struct trigger *next;
 
-    variant data;
-  } trigger;
+        variant data;
+    } trigger;
 
-  typedef struct event_arg {
-    const char *type;
-    variant data;
-  } event_arg;
+    typedef struct event_arg {
+        const char *type;
+        variant data;
+    } event_arg;
 
-  extern trigger *t_new(trigger_type * ttype);
-  extern void t_free(trigger * t);
-  extern void t_add(trigger ** tlist, trigger * t);
-/** add and handle triggers **/
+    trigger *t_new(trigger_type * ttype);
+    void t_free(trigger * t);
+    void t_add(trigger ** tlist, trigger * t);
+    /** add and handle triggers **/
 
-/* add a trigger to a list of attributes */
-  extern void add_trigger(struct attrib **ap, const char *eventname,
+    /* add a trigger to a list of attributes */
+    void add_trigger(struct attrib **ap, const char *eventname,
     struct trigger *t);
-  extern void remove_triggers(struct attrib **ap, const char *eventname,
-    const trigger_type * tt);
-  extern struct trigger **get_triggers(struct attrib *ap,
-    const char *eventname);
-/* calls handle() for each of these. e.g. used in timeout */
-  extern void handle_event(struct attrib *attribs, const char *eventname,
-    void *data);
+    void remove_triggers(struct attrib **ap, const char *eventname,
+        const trigger_type * tt);
+    struct trigger **get_triggers(struct attrib *ap,
+        const char *eventname);
+    /* calls handle() for each of these. e.g. used in timeout */
+    void handle_event(struct attrib *attribs, const char *eventname,
+        void *data);
 
-/* functions for making complex triggers: */
-  extern void free_triggers(trigger * triggers);        /* release all these triggers */
-  extern void write_triggers(struct storage *store, const trigger * t);
-  extern int read_triggers(struct storage *store, trigger ** tp);
-  extern int handle_triggers(trigger ** triggers, void *data);
+    /* functions for making complex triggers: */
+    void free_triggers(trigger * triggers);        /* release all these triggers */
+    void write_triggers(struct storage *store, const trigger * t);
+    int read_triggers(struct storage *store, trigger ** tp);
+    int handle_triggers(trigger ** triggers, void *data);
 
-  extern struct attrib_type at_eventhandler;
+    extern struct attrib_type at_eventhandler;
 
 #ifdef __cplusplus
 }
diff --git a/src/util/filereader.c b/src/util/filereader.c
index 2a49b7bdd..ee5ec398c 100644
--- a/src/util/filereader.c
+++ b/src/util/filereader.c
@@ -15,312 +15,329 @@ static char fbuf[MAXLINE];
 
 static void unicode_warning(const char *bp)
 {
-  log_warning("invalid sequence in UTF-8 string: %s\n", bp);
+    log_warning("invalid sequence in UTF-8 string: %s\n", bp);
 }
 
 INLINE_FUNCTION int eatwhite(const char *ptr, size_t * total_size)
 {
-  int ret = 0;
+    int ret = 0;
 
-  *total_size = 0;
+    *total_size = 0;
 
-  while (*ptr) {
-    ucs4_t ucs;
-    size_t size = 0;
-    ret = unicode_utf8_to_ucs4(&ucs, ptr, &size);
-    if (ret != 0)
-      break;
-    if (!iswxspace((wint_t) ucs))
-      break;
-    *total_size += size;
-    ptr += size;
-  }
-  return ret;
+    while (*ptr) {
+        ucs4_t ucs;
+        size_t size = 0;
+        ret = unicode_utf8_to_ucs4(&ucs, ptr, &size);
+        if (ret != 0)
+            break;
+        if (!iswxspace((wint_t)ucs))
+            break;
+        *total_size += size;
+        ptr += size;
+    }
+    return ret;
 }
 
 static const char *getbuf_latin1(FILE * F)
 {
-  bool cont = false;
-  char quote = 0;
-  bool comment = false;
-  char *cp = fbuf;
-  char *tail = lbuf + MAXLINE - 2;
+    bool cont = false;
+    char quote = 0;
+    bool comment = false;
+    char *cp = fbuf;
+    char *tail = lbuf + MAXLINE - 2;
 
-  tail[1] = '@';                /* if this gets overwritten by fgets then the line was very long. */
-  do {
-    const char *bp = fgets(lbuf, MAXLINE, F);
+    tail[1] = '@';                /* if this gets overwritten by fgets then the line was very long. */
+    do {
+        const char *bp = fgets(lbuf, MAXLINE, F);
 
-    if (bp == NULL)
-      return NULL;
-    while (*bp && isxspace(*(unsigned char *)bp))
-      ++bp;                     /* eatwhite */
-
-    comment = (bool) (comment && cont);
-    quote = (bool) (quote && cont);
-
-    if (tail[1] == 0) {
-      /* we read he maximum number of bytes! */
-      if (tail[0] != '\n') {
-        /* it wasn't enough space to finish the line, eat the rest */
-        for (;;) {
-          tail[1] = '@';
-          bp = fgets(lbuf, MAXLINE, F);
-          if (bp == NULL)
+        if (bp == NULL)
             return NULL;
-          if (tail[1]) {
-            /* read enough this time to end the line */
-            break;
-          }
+        while (*bp && isxspace(*(unsigned char *)bp))
+            ++bp;                     /* eatwhite */
+
+        comment = (bool)(comment && cont);
+        quote = (bool)(quote && cont);
+
+        if (tail[1] == 0) {
+            /* we read he maximum number of bytes! */
+            if (tail[0] != '\n') {
+                /* it wasn't enough space to finish the line, eat the rest */
+                for (;;) {
+                    tail[1] = '@';
+                    bp = fgets(lbuf, MAXLINE, F);
+                    if (bp == NULL)
+                        return NULL;
+                    if (tail[1]) {
+                        /* read enough this time to end the line */
+                        break;
+                    }
+                }
+                comment = false;
+                cont = false;
+                bp = NULL;
+                continue;
+            }
+            else {
+                tail[1] = '@';
+            }
         }
-        comment = false;
         cont = false;
-        bp = NULL;
-        continue;
-      } else {
-        tail[1] = '@';
-      }
-    }
-    cont = false;
-    while (*bp && cp < fbuf + MAXLINE) {
-      int c = *(unsigned char *)bp;
+        while (*bp && cp < fbuf + MAXLINE) {
+            int c = *(unsigned char *)bp;
 
-      if (c == '\n' || c == '\r') {
-        /* line breaks, shmine breaks */
-        break;
-      }
-      if (c == COMMENT_CHAR && !quote) {
-        /* comment begins. we need to keep going, to look for CONTINUE_CHAR */
-        comment = true;
-        ++bp;
-        continue;
-      }
-      if (!comment && (c == '"' || c == '\'')) {
-        if (quote == c) {
-          quote = 0;
-          if (cp < fbuf + MAXLINE)
-            *cp++ = *bp;
-          ++bp;
-          continue;
-        } else if (!quote) {
-          quote = *bp++;
-          if (cp < fbuf + MAXLINE)
-            *cp++ = quote;
-          continue;
-        }
-      }
+            if (c == '\n' || c == '\r') {
+                /* line breaks, shmine breaks */
+                break;
+            }
+            if (c == COMMENT_CHAR && !quote) {
+                /* comment begins. we need to keep going, to look for CONTINUE_CHAR */
+                comment = true;
+                ++bp;
+                continue;
+            }
+            if (!comment && (c == '"' || c == '\'')) {
+                if (quote == c) {
+                    quote = 0;
+                    if (cp < fbuf + MAXLINE)
+                        *cp++ = *bp;
+                    ++bp;
+                    continue;
+                }
+                else if (!quote) {
+                    quote = *bp++;
+                    if (cp < fbuf + MAXLINE)
+                        *cp++ = quote;
+                    continue;
+                }
+            }
 
-      if (iscntrl(c)) {
-        if (!comment && cp < fbuf + MAXLINE) {
-          *cp++ = isxspace(c) ? ' ' : '?';
-        }
-        ++bp;
-        continue;
-      } else if (isxspace(c)) {
-        if (!quote) {
-          ++bp;
-          while (*bp && isxspace(*(unsigned char *)bp))
-            ++bp;               /* eatwhite */
-          if (!comment && *bp && *bp != COMMENT_CHAR && cp < fbuf + MAXLINE)
-            *(cp++) = ' ';
-        } else if (!comment && cp + 1 <= fbuf + MAXLINE) {
-          *(cp++) = *(bp++);
-        } else {
-          ++bp;
-        }
-        continue;
-      } else if (c == CONTINUE_CHAR) {
-        const char *end = ++bp;
-        while (*end && isxspace(*(unsigned char *)end))
-          ++end;                /* eatwhite */
-        if (*end == '\0') {
-          bp = end;
-          cont = true;
-          continue;
-        }
-        if (comment) {
-          ++bp;
-          continue;
-        }
-      } else if (comment) {
-        ++bp;
-        continue;
-      }
+            if (iscntrl(c)) {
+                if (!comment && cp < fbuf + MAXLINE) {
+                    *cp++ = isxspace(c) ? ' ' : '?';
+                }
+                ++bp;
+                continue;
+            }
+            else if (isxspace(c)) {
+                if (!quote) {
+                    ++bp;
+                    while (*bp && isxspace(*(unsigned char *)bp))
+                        ++bp;               /* eatwhite */
+                    if (!comment && *bp && *bp != COMMENT_CHAR && cp < fbuf + MAXLINE)
+                        *(cp++) = ' ';
+                }
+                else if (!comment && cp + 1 <= fbuf + MAXLINE) {
+                    *(cp++) = *(bp++);
+                }
+                else {
+                    ++bp;
+                }
+                continue;
+            }
+            else if (c == CONTINUE_CHAR) {
+                const char *end = ++bp;
+                while (*end && isxspace(*(unsigned char *)end))
+                    ++end;                /* eatwhite */
+                if (*end == '\0') {
+                    bp = end;
+                    cont = true;
+                    continue;
+                }
+                if (comment) {
+                    ++bp;
+                    continue;
+                }
+            }
+            else if (comment) {
+                ++bp;
+                continue;
+            }
 
-      if (c < 0x80) {
-        if (cp + 1 <= fbuf + MAXLINE) {
-          *(cp++) = *(bp++);
-        }
-      } else {
-        char inbuf = (char)c;
-        size_t inbytes = 1;
-        size_t outbytes = MAXLINE - (cp - fbuf);
-        int ret = unicode_latin1_to_utf8(cp, &outbytes, &inbuf, &inbytes);
-        if (ret > 0)
-          cp += ret;
-        else {
-          log_error("input data was not iso-8859-1! assuming utf-8\n");
-          return NULL;
-        }
+            if (c < 0x80) {
+                if (cp + 1 <= fbuf + MAXLINE) {
+                    *(cp++) = *(bp++);
+                }
+            }
+            else {
+                char inbuf = (char)c;
+                size_t inbytes = 1;
+                size_t outbytes = MAXLINE - (cp - fbuf);
+                int ret = unicode_latin1_to_utf8(cp, &outbytes, &inbuf, &inbytes);
+                if (ret > 0)
+                    cp += ret;
+                else {
+                    log_error("input data was not iso-8859-1! assuming utf-8\n");
+                    return NULL;
+                }
 
-        ++bp;
-        continue;
-      }
-    }
-    if (cp == fbuf + MAXLINE) {
-      --cp;
-    }
-    *cp = 0;
-  } while (cont || cp == fbuf);
-  return fbuf;
+                ++bp;
+                continue;
+            }
+        }
+        if (cp == fbuf + MAXLINE) {
+            --cp;
+        }
+        *cp = 0;
+    } while (cont || cp == fbuf);
+    return fbuf;
 }
 
 static const char *getbuf_utf8(FILE * F)
 {
-  bool cont = false;
-  char quote = 0;
-  bool comment = false;
-  char *cp = fbuf;
-  char *tail = lbuf + MAXLINE - 2;
+    bool cont = false;
+    char quote = 0;
+    bool comment = false;
+    char *cp = fbuf;
+    char *tail = lbuf + MAXLINE - 2;
 
-  tail[1] = '@';                /* if this gets overwritten by fgets then the line was very long. */
-  do {
-    const char *bp = fgets(lbuf, MAXLINE, F);
-    size_t white;
-    if (bp == NULL) {
-      return NULL;
-    }
-
-    eatwhite(bp, &white);       /* decoding errors will get caught later on, don't have to check */
-    bp += white;
-
-    comment = (bool) (comment && cont);
-    quote = (bool) (quote && cont);
-
-    if (tail[1] == 0) {
-      /* we read the maximum number of bytes! */
-      if (tail[0] != '\n') {
-        /* it wasn't enough space to finish the line, eat the rest */
-        for (;;) {
-          tail[1] = '@';
-          bp = fgets(lbuf, MAXLINE, F);
-          if (bp == NULL)
+    tail[1] = '@';                /* if this gets overwritten by fgets then the line was very long. */
+    do {
+        const char *bp = fgets(lbuf, MAXLINE, F);
+        size_t white;
+        if (bp == NULL) {
             return NULL;
-          if (tail[1]) {
-            /* read enough this time to end the line */
-            break;
-          }
         }
-        comment = false;
+
+        eatwhite(bp, &white);       /* decoding errors will get caught later on, don't have to check */
+        bp += white;
+
+        comment = (bool)(comment && cont);
+        quote = (bool)(quote && cont);
+
+        if (tail[1] == 0) {
+            /* we read the maximum number of bytes! */
+            if (tail[0] != '\n') {
+                /* it wasn't enough space to finish the line, eat the rest */
+                for (;;) {
+                    tail[1] = '@';
+                    bp = fgets(lbuf, MAXLINE, F);
+                    if (bp == NULL)
+                        return NULL;
+                    if (tail[1]) {
+                        /* read enough this time to end the line */
+                        break;
+                    }
+                }
+                comment = false;
+                cont = false;
+                bp = NULL;
+                continue;
+            }
+            else {
+                tail[1] = '@';
+            }
+        }
         cont = false;
-        bp = NULL;
-        continue;
-      } else {
-        tail[1] = '@';
-      }
-    }
-    cont = false;
-    while (*bp && cp < fbuf + MAXLINE) {
-      ucs4_t ucs;
-      size_t size;
-      int ret;
+        while (*bp && cp < fbuf + MAXLINE) {
+            ucs4_t ucs;
+            size_t size;
+            int ret;
 
-      if (!quote) {
-        while (*bp == COMMENT_CHAR) {
-          /* comment begins. we need to keep going, to look for CONTINUE_CHAR */
-          comment = true;
-          ++bp;
-        }
-      }
-
-      if (*bp == '\n' || *bp == '\r') {
-        /* line breaks, shmine breaks */
-        break;
-      }
-
-      if (*bp == '"' || *bp == '\'') {
-        if (quote == *bp) {
-          quote = 0;
-          if (!comment && cp < fbuf + MAXLINE)
-            *cp++ = *bp;
-          ++bp;
-          continue;
-        } else if (!quote) {
-          quote = *bp++;
-          if (!comment && cp < fbuf + MAXLINE)
-            *cp++ = quote;
-          continue;
-        }
-      }
-
-      ret = unicode_utf8_to_ucs4(&ucs, bp, &size);
-
-      if (ret != 0) {
-        unicode_warning(bp);
-        break;
-      }
-
-      if (iswxspace((wint_t) ucs)) {
-        if (!quote) {
-          bp += size;
-          ret = eatwhite(bp, &size);
-          bp += size;
-          if (!comment && *bp && *bp != COMMENT_CHAR && cp < fbuf + MAXLINE)
-            *(cp++) = ' ';
-          if (ret != 0) {
-            unicode_warning(bp);
-            break;
-          }
-        } else if (!comment) {
-          if (cp + size <= fbuf + MAXLINE) {
-            while (size--) {
-              *(cp++) = *(bp++);
+            if (!quote) {
+                while (*bp == COMMENT_CHAR) {
+                    /* comment begins. we need to keep going, to look for CONTINUE_CHAR */
+                    comment = true;
+                    ++bp;
+                }
             }
-          } else
-            bp += size;
-        } else {
-          bp += size;
-        }
-      } else if (iswcntrl((wint_t) ucs)) {
-        if (!comment && cp < fbuf + MAXLINE) {
-          *cp++ = '?';
-        }
-        bp += size;
-      } else {
-        if (*bp == CONTINUE_CHAR) {
-          const char *end;
-          eatwhite(bp + 1, &white);
-          end = bp + 1 + white;
-          if (*end == '\0') {
-            bp = end;
-            cont = true;
-            continue;
-          }
-          if (!comment && cp < fbuf + MAXLINE)
-            *cp++ = *bp++;
-          else
-            ++bp;
-        } else {
-          if (!comment && cp + size <= fbuf + MAXLINE) {
-            while (size--) {
-              *(cp++) = *(bp++);
+
+            if (*bp == '\n' || *bp == '\r') {
+                /* line breaks, shmine breaks */
+                break;
+            }
+
+            if (*bp == '"' || *bp == '\'') {
+                if (quote == *bp) {
+                    quote = 0;
+                    if (!comment && cp < fbuf + MAXLINE)
+                        *cp++ = *bp;
+                    ++bp;
+                    continue;
+                }
+                else if (!quote) {
+                    quote = *bp++;
+                    if (!comment && cp < fbuf + MAXLINE)
+                        *cp++ = quote;
+                    continue;
+                }
+            }
+
+            ret = unicode_utf8_to_ucs4(&ucs, bp, &size);
+
+            if (ret != 0) {
+                unicode_warning(bp);
+                break;
+            }
+
+            if (iswxspace((wint_t)ucs)) {
+                if (!quote) {
+                    bp += size;
+                    ret = eatwhite(bp, &size);
+                    bp += size;
+                    if (!comment && *bp && *bp != COMMENT_CHAR && cp < fbuf + MAXLINE)
+                        *(cp++) = ' ';
+                    if (ret != 0) {
+                        unicode_warning(bp);
+                        break;
+                    }
+                }
+                else if (!comment) {
+                    if (cp + size <= fbuf + MAXLINE) {
+                        while (size--) {
+                            *(cp++) = *(bp++);
+                        }
+                    }
+                    else
+                        bp += size;
+                }
+                else {
+                    bp += size;
+                }
+            }
+            else if (iswcntrl((wint_t)ucs)) {
+                if (!comment && cp < fbuf + MAXLINE) {
+                    *cp++ = '?';
+                }
+                bp += size;
+            }
+            else {
+                if (*bp == CONTINUE_CHAR) {
+                    const char *end;
+                    eatwhite(bp + 1, &white);
+                    end = bp + 1 + white;
+                    if (*end == '\0') {
+                        bp = end;
+                        cont = true;
+                        continue;
+                    }
+                    if (!comment && cp < fbuf + MAXLINE)
+                        *cp++ = *bp++;
+                    else
+                        ++bp;
+                }
+                else {
+                    if (!comment && cp + size <= fbuf + MAXLINE) {
+                        while (size--) {
+                            *(cp++) = *(bp++);
+                        }
+                    }
+                    else {
+                        bp += size;
+                    }
+                }
             }
-          } else {
-            bp += size;
-          }
         }
-      }
-    }
-    if (cp == fbuf + MAXLINE) {
-      --cp;
-    }
-    *cp = 0;
-  } while (cont || cp == fbuf);
-  return fbuf;
+        if (cp == fbuf + MAXLINE) {
+            --cp;
+        }
+        *cp = 0;
+    } while (cont || cp == fbuf);
+    return fbuf;
 }
 
 const char *getbuf(FILE * F, int encoding)
 {
-  if (encoding == ENCODING_UTF8)
-    return getbuf_utf8(F);
-  return getbuf_latin1(F);
+    if (encoding == ENCODING_UTF8)
+        return getbuf_utf8(F);
+    return getbuf_latin1(F);
 }
diff --git a/src/util/filereader.h b/src/util/filereader.h
index 116e2341a..eb09d14e1 100644
--- a/src/util/filereader.h
+++ b/src/util/filereader.h
@@ -1,11 +1,11 @@
-/* vi: set ts=2:
+/* 
 * +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
 * |                   |  Enno Rehling <enno@eressea.de>
 * | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
-* | (c) 1998 - 2005   |  
+* | (c) 1998 - 2005   |
 * |                   |  This program may not be used, modified or distributed
 * +-------------------+  without prior permission by the authors of Eressea.
-*  
+*
 */
 #ifndef UTIL_FILEREADER_H
 #define UTIL_FILEREADER_H
@@ -18,7 +18,7 @@ extern "C" {
 #define ENCODING_UTF8   0
 #define ENCODING_LATIN1 1
 
-  const char *getbuf(FILE *, int encoding);
+    const char *getbuf(FILE *, int encoding);
 
 #ifdef __cplusplus
 }
diff --git a/src/util/functions.c b/src/util/functions.c
index 3de812b7f..44e8f8cf4 100644
--- a/src/util/functions.c
+++ b/src/util/functions.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -30,21 +30,21 @@ static critbit_tree cb_functions;
 
 pf_generic get_function(const char *name)
 {
-  const void * matches;
-  pf_generic result;
-  if (cb_find_prefix(&cb_functions, name, strlen(name)+1, &matches, 1, 0)) {
-    cb_get_kv(matches, &result, sizeof(result));
-    return result;
-  }
-  return NULL;
+    const void * matches;
+    pf_generic result;
+    if (cb_find_prefix(&cb_functions, name, strlen(name) + 1, &matches, 1, 0)) {
+        cb_get_kv(matches, &result, sizeof(result));
+        return result;
+    }
+    return NULL;
 }
 
 void register_function(pf_generic fun, const char *name)
 {
-  char buffer[64];
-  size_t len = strlen(name);
+    char buffer[64];
+    size_t len = strlen(name);
 
-  assert(len<sizeof(buffer)-sizeof(fun));
-  len = cb_new_kv(name, len, &fun, sizeof(fun), buffer);
-  cb_insert(&cb_functions, buffer, len);
+    assert(len < sizeof(buffer) - sizeof(fun));
+    len = cb_new_kv(name, len, &fun, sizeof(fun), buffer);
+    cb_insert(&cb_functions, buffer, len);
 }
diff --git a/src/util/functions.h b/src/util/functions.h
index abff99d99..5628673ee 100644
--- a/src/util/functions.h
+++ b/src/util/functions.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,10 +22,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  typedef void (*pf_generic) (void);
+    typedef void(*pf_generic) (void);
 
-  extern pf_generic get_function(const char *name);
-  extern void register_function(pf_generic fun, const char *name);
+    pf_generic get_function(const char *name);
+    void register_function(pf_generic fun, const char *name);
 
 #ifdef __cplusplus
 }
diff --git a/src/util/functions.test.c b/src/util/functions.test.c
index cb229993d..ddd882821 100644
--- a/src/util/functions.test.c
+++ b/src/util/functions.test.c
@@ -6,18 +6,18 @@
 
 static void test_functions(CuTest * tc)
 {
-  pf_generic fun;
-  
-  fun = get_function("herpderp");
-  CuAssertTrue(tc, !fun);
-  register_function((pf_generic)test_functions, "herpderp");
-  fun = get_function("herpderp");
-  CuAssertTrue(tc, fun==(pf_generic)test_functions);
+    pf_generic fun;
+
+    fun = get_function("herpderp");
+    CuAssertTrue(tc, !fun);
+    register_function((pf_generic)test_functions, "herpderp");
+    fun = get_function("herpderp");
+    CuAssertTrue(tc, fun == (pf_generic)test_functions);
 }
 
 CuSuite *get_functions_suite(void)
 {
-  CuSuite *suite = CuSuiteNew();
-  SUITE_ADD_TEST(suite, test_functions);
-  return suite;
+    CuSuite *suite = CuSuiteNew();
+    SUITE_ADD_TEST(suite, test_functions);
+    return suite;
 }
diff --git a/src/util/goodies.c b/src/util/goodies.c
index b82a538dc..1bf328c6d 100644
--- a/src/util/goodies.c
+++ b/src/util/goodies.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -30,108 +30,110 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 int *intlist_init(void)
 {
-  return (calloc(1, sizeof(int)));
+    return (calloc(1, sizeof(int)));
 }
 
 int *intlist_add(int *i_p, int i)
 {
-  i_p[0]++;
-  i_p = realloc(i_p, (i_p[0] + 1) * sizeof(int));
+    i_p[0]++;
+    i_p = realloc(i_p, (i_p[0] + 1) * sizeof(int));
 
-  i_p[i_p[0]] = i;
-  return (i_p);
+    i_p[i_p[0]] = i;
+    return (i_p);
 }
 
 int *intlist_find(int *i_p, int fi)
 {
-  int i;
+    int i;
 
-  for (i = 1; i <= i_p[0]; i++) {
-    if (i_p[i] == fi)
-      return (&i_p[i]);
-  }
-  return NULL;
+    for (i = 1; i <= i_p[0]; i++) {
+        if (i_p[i] == fi)
+            return (&i_p[i]);
+    }
+    return NULL;
 }
 
 char *set_string(char **s, const char *neu)
 {
-  if (neu == NULL) {
-    free(*s);
-    *s = NULL;
-  } else if (*s == NULL) {
-    *s = malloc(strlen(neu) + 1);
-    strcpy(*s, neu);
-  } else {
-    *s = realloc(*s, strlen(neu) + 1);
-    strcpy(*s, neu);
-  }
-  return *s;
+    if (neu == NULL) {
+        free(*s);
+        *s = NULL;
+    }
+    else if (*s == NULL) {
+        *s = malloc(strlen(neu) + 1);
+        strcpy(*s, neu);
+    }
+    else {
+        *s = realloc(*s, strlen(neu) + 1);
+        strcpy(*s, neu);
+    }
+    return *s;
 }
 
 static int spc_email_isvalid(const char *address)
 {
-  int count = 0;
-  const char *c, *domain;
-  static const char *rfc822_specials = "()<>@,;:\\\"[]";        /* STATIC_CONST: contains a constant value */
+    int count = 0;
+    const char *c, *domain;
+    static const char *rfc822_specials = "()<>@,;:\\\"[]";        /* STATIC_CONST: contains a constant value */
 
-  /* first we validate the name portion (name@domain) */
-  for (c = address; *c; c++) {
-    if (*c == '\"' && (c == address || *(c - 1) == '.' || *(c - 1) == '\"')) {
-      while (*++c) {
-        if (*c == '\"')
-          break;
-        if (*c == '\\' && (*++c == ' '))
-          continue;
+    /* first we validate the name portion (name@domain) */
+    for (c = address; *c; c++) {
+        if (*c == '\"' && (c == address || *(c - 1) == '.' || *(c - 1) == '\"')) {
+            while (*++c) {
+                if (*c == '\"')
+                    break;
+                if (*c == '\\' && (*++c == ' '))
+                    continue;
+                if (*c <= ' ' || *c >= 127)
+                    return 0;
+            }
+            if (!*c++)
+                return 0;
+            if (*c == '@')
+                break;
+            if (*c != '.')
+                return 0;
+            continue;
+        }
+        if (*c == '@')
+            break;
         if (*c <= ' ' || *c >= 127)
-          return 0;
-      }
-      if (!*c++)
-        return 0;
-      if (*c == '@')
-        break;
-      if (*c != '.')
-        return 0;
-      continue;
+            return 0;
+        if (strchr(rfc822_specials, *c))
+            return 0;
     }
-    if (*c == '@')
-      break;
-    if (*c <= ' ' || *c >= 127)
-      return 0;
-    if (strchr(rfc822_specials, *c))
-      return 0;
-  }
-  if (c == address || *(c - 1) == '.')
-    return 0;
-
-  /* next we validate the domain portion (name@domain) */
-  if (!*(domain = ++c))
-    return 0;
-  do {
-    if (*c == '.') {
-      if (c == domain || *(c - 1) == '.')
+    if (c == address || *(c - 1) == '.')
         return 0;
-      count++;
-    }
-    if (*c <= ' ' || *c >= 127)
-      return 0;
-    if (strchr(rfc822_specials, *c))
-      return 0;
-  } while (*++c);
 
-  return (count >= 1);
+    /* next we validate the domain portion (name@domain) */
+    if (!*(domain = ++c))
+        return 0;
+    do {
+        if (*c == '.') {
+            if (c == domain || *(c - 1) == '.')
+                return 0;
+            count++;
+        }
+        if (*c <= ' ' || *c >= 127)
+            return 0;
+        if (strchr(rfc822_specials, *c))
+            return 0;
+    } while (*++c);
+
+    return (count >= 1);
 }
 
 int set_email(char **pemail, const char *newmail)
 {
-  if (newmail && *newmail) {
-    if (spc_email_isvalid(newmail) <= 0)
-      return -1;
-  }
-  if (*pemail)
-    free(*pemail);
-  *pemail = 0;
-  if (newmail) {
-    *pemail = _strdup(newmail);
-  }
-  return 0;
+    if (newmail && *newmail) {
+        if (spc_email_isvalid(newmail) <= 0)
+            return -1;
+    }
+    if (*pemail)
+        free(*pemail);
+    *pemail = 0;
+    if (newmail) {
+        *pemail = _strdup(newmail);
+    }
+    return 0;
 }
diff --git a/src/util/goodies.h b/src/util/goodies.h
index b774bbb04..6e2cf8418 100644
--- a/src/util/goodies.h
+++ b/src/util/goodies.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,25 +22,25 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  extern char *set_string(char **s, const char *neu);
-  extern int set_email(char **pemail, const char *newmail);
+    extern char *set_string(char **s, const char *neu);
+    extern int set_email(char **pemail, const char *newmail);
 
-  extern int *intlist_init(void);
-  extern int *intlist_add(int *i_p, int i);
-  extern int *intlist_find(int *i_p, int i);
+    extern int *intlist_init(void);
+    extern int *intlist_add(int *i_p, int i);
+    extern int *intlist_find(int *i_p, int i);
 
-  extern unsigned int hashstring(const char *s);
-  extern const char *escape_string(const char *str, char *buffer,
-    unsigned int len);
-  extern unsigned int jenkins_hash(unsigned int a);
-  extern unsigned int wang_hash(unsigned int a);
+    extern unsigned int hashstring(const char *s);
+    extern const char *escape_string(const char *str, char *buffer,
+        unsigned int len);
+    extern unsigned int jenkins_hash(unsigned int a);
+    extern unsigned int wang_hash(unsigned int a);
 
-/* benchmark for units: 
- * JENKINS_HASH: 5.25 misses/hit (with good cache behavior)
- * WANG_HASH:    5.33 misses/hit (with good cache behavior)
- * KNUTH_HASH:   1.93 misses/hit (with bad cache behavior)
- * CF_HASH:      fucking awful!
- */
+    /* benchmark for units:
+     * JENKINS_HASH: 5.25 misses/hit (with good cache behavior)
+     * WANG_HASH:    5.33 misses/hit (with good cache behavior)
+     * KNUTH_HASH:   1.93 misses/hit (with bad cache behavior)
+     * CF_HASH:      fucking awful!
+     */
 #define KNUTH_HASH1(a, m) ((a) % m)
 #define KNUTH_HASH2(a, m) (m - 2 - a % (m-2))
 #define CF_HASH1(a, m) ((a) % m)
diff --git a/src/util/language.c b/src/util/language.c
index f23643b6d..dcf9e3e9f 100644
--- a/src/util/language.c
+++ b/src/util/language.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/util/language.h b/src/util/language.h
index b6e22d5e5..4c9a4e716 100644
--- a/src/util/language.h
+++ b/src/util/language.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -27,54 +27,54 @@ extern "C" {
 
 #define MAXLOCALES 3
 
-  struct locale;
-  struct critbit_tree;
+    struct locale;
+    struct critbit_tree;
 
-/** managing multiple locales: **/
-  extern struct locale *get_locale(const char *name);
-  extern struct locale *get_or_create_locale(const char *key);
-  void init_locales(void);
-  void free_locales(void);
-  void reset_locales(void);
+    /** managing multiple locales: **/
+    extern struct locale *get_locale(const char *name);
+    extern struct locale *get_or_create_locale(const char *key);
+    void init_locales(void);
+    void free_locales(void);
+    void reset_locales(void);
 
-  /** operations on locales: **/
-  extern void locale_setstring(struct locale *lang, const char *key,
-    const char *value);
-  extern const char *locale_getstring(const struct locale *lang,
-    const char *key);
-  extern const char *locale_string(const struct locale *lang, const char *key, bool warn); /* does fallback */
-  extern unsigned int locale_index(const struct locale *lang);
-  extern const char *locale_name(const struct locale *lang);
+    /** operations on locales: **/
+    extern void locale_setstring(struct locale *lang, const char *key,
+        const char *value);
+    extern const char *locale_getstring(const struct locale *lang,
+        const char *key);
+    extern const char *locale_string(const struct locale *lang, const char *key, bool warn); /* does fallback */
+    extern unsigned int locale_index(const struct locale *lang);
+    extern const char *locale_name(const struct locale *lang);
 
-  extern const char *mkname(const char *namespc, const char *key);
-  extern char *mkname_buf(const char *namespc, const char *key, char *buffer);
+    extern const char *mkname(const char *namespc, const char *key);
+    extern char *mkname_buf(const char *namespc, const char *key, char *buffer);
 
-  extern void make_locales(const char *str);
+    extern void make_locales(const char *str);
 
 #define LOC(lang, s) (lang?locale_string(lang, s, true):s)
 
-  extern struct locale *default_locale;
-  extern struct locale *locales;
-  extern struct locale *nextlocale(const struct locale *lang);
+    extern struct locale *default_locale;
+    extern struct locale *locales;
+    extern struct locale *nextlocale(const struct locale *lang);
 
-  enum {
-    UT_PARAMS,
-    UT_KEYWORDS,
-    UT_SKILLS,
-    UT_RACES,
-    UT_OPTIONS,
-    UT_DIRECTIONS,
-    UT_ARCHETYPES,
-    UT_MAGIC,
-    UT_TERRAINS,
-    UT_SPECDIR,
-    UT_MAX
-  };
+    enum {
+        UT_PARAMS,
+        UT_KEYWORDS,
+        UT_SKILLS,
+        UT_RACES,
+        UT_OPTIONS,
+        UT_DIRECTIONS,
+        UT_ARCHETYPES,
+        UT_MAGIC,
+        UT_TERRAINS,
+        UT_SPECDIR,
+        UT_MAX
+    };
 
-  void ** get_translations(const struct locale *lang, int type);
-  void * get_translation(const struct locale *lang, const char *str, int type);
-  void init_translations(const struct locale *lang, int ut, const char * (*string_cb)(int i), int maxstrings);
-  void add_translation(struct critbit_tree **cb, const char *str, int i);
+    void ** get_translations(const struct locale *lang, int type);
+    void * get_translation(const struct locale *lang, const char *str, int type);
+    void init_translations(const struct locale *lang, int ut, const char * (*string_cb)(int i), int maxstrings);
+    void add_translation(struct critbit_tree **cb, const char *str, int i);
 
 #ifdef __cplusplus
 }
diff --git a/src/util/lists.c b/src/util/lists.c
index 912699bc7..f39e413bc 100644
--- a/src/util/lists.c
+++ b/src/util/lists.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -23,100 +23,101 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include "lists.h"
 
 typedef struct void_list {
-  struct void_list *next;
-  void *data;
+    struct void_list *next;
+    void *data;
 } void_list;
 
 void addlist(void *l1, void *p1)
 {
 
-  /* add entry p to the end of list l */
+    /* add entry p to the end of list l */
 
-  void_list **l;
-  void_list *p, *q;
+    void_list **l;
+    void_list *p, *q;
 
-  l = (void_list **) l1;
-  p = (void_list *) p1;
-  assert(p->next == 0);
+    l = (void_list **)l1;
+    p = (void_list *)p1;
+    assert(p->next == 0);
 
-  if (*l) {
-    for (q = *l; q->next; q = q->next)
-      assert(q);
-    q->next = p;
-  } else
-    *l = p;
+    if (*l) {
+        for (q = *l; q->next; q = q->next)
+            assert(q);
+        q->next = p;
+    }
+    else
+        *l = p;
 }
 
 static void choplist(void *a, void *b)
 {
-  void_list **l = (void_list **) a, *p = (void_list *) b;
-  /* remove entry p from list l - when called, a pointer to p must be
-   * kept in order to use (and free) p; if omitted, this will be a
-   * memory leak */
+    void_list **l = (void_list **)a, *p = (void_list *)b;
+    /* remove entry p from list l - when called, a pointer to p must be
+     * kept in order to use (and free) p; if omitted, this will be a
+     * memory leak */
 
-  void_list **q;
+    void_list **q;
 
-  for (q = l; *q; q = &((*q)->next)) {
-    if (*q == p) {
-      *q = p->next;
-      p->next = 0;
-      break;
+    for (q = l; *q; q = &((*q)->next)) {
+        if (*q == p) {
+            *q = p->next;
+            p->next = 0;
+            break;
+        }
     }
-  }
 }
 
 void translist(void *l1, void *l2, void *p)
 {
 
-  /* remove entry p from list l1 and add it at the end of list l2 */
+    /* remove entry p from list l1 and add it at the end of list l2 */
 
-  choplist(l1, p);
-  addlist(l2, p);
+    choplist(l1, p);
+    addlist(l2, p);
 }
 
 void insertlist(void_list ** l, void_list * p)
 {
 
-  /* insert entry p at the beginning of list l */
+    /* insert entry p at the beginning of list l */
 
-  p->next = *l;
-  *l = p;
+    p->next = *l;
+    *l = p;
 
 }
 
 void removelist(void *l, void *p)
 {
 
-  /* remove entry p from list l; free p */
+    /* remove entry p from list l; free p */
 
-  choplist(l, p);
-  free(p);
+    choplist(l, p);
+    free(p);
 }
 
 void freelist(void *p1)
 {
 
-  /* remove all entries following and including entry p from a listlist */
+    /* remove all entries following and including entry p from a listlist */
 
-  void_list *p, *p2;
+    void_list *p, *p2;
 
-  p = (void_list *) p1;
+    p = (void_list *)p1;
 
-  while (p) {
-    p2 = p->next;
-    free(p);
-    p = p2;
-  }
+    while (p) {
+        p2 = p->next;
+        free(p);
+        p = p2;
+    }
 }
 
 unsigned int listlen(void *l)
 {
 
-  /* count entries p in list l */
+    /* count entries p in list l */
 
-  unsigned int i;
-  void_list *p;
+    unsigned int i;
+    void_list *p;
 
-  for (p = (void_list *) l, i = 0; p; p = p->next, i++) ;
-  return i;
+    for (p = (void_list *)l, i = 0; p; p = p->next, i++);
+    return i;
 }
diff --git a/src/util/lists.h b/src/util/lists.h
index b12edd316..badde7cea 100644
--- a/src/util/lists.h
+++ b/src/util/lists.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -24,17 +24,17 @@ extern "C" {
 
 #include <stddef.h>
 
-  void addlist(void *l1, void *p1);
-  void translist(void *l1, void *l2, void *p);
+    void addlist(void *l1, void *p1);
+    void translist(void *l1, void *l2, void *p);
 #ifndef MALLOCDBG
-  void freelist(void *p1);
-  void removelist(void *l, void *p);
+    void freelist(void *p1);
+    void removelist(void *l, void *p);
 #else
 #define freelist(p) { while (p) { void * p2 = p->next; free(p); p = p2; } }
 #define removelist(l,p) { choplist(l, p); free(p); }
 #endif
 
-  unsigned int listlen(void *l);
+    unsigned int listlen(void *l);
 
 #ifdef __cplusplus
 }
diff --git a/src/util/log.c b/src/util/log.c
index 4b3e358dd..d67fd6775 100644
--- a/src/util/log.c
+++ b/src/util/log.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/*
 +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -35,285 +35,288 @@ static FILE *logfile;
 #define LOG_MAXBACKUPS 5
 void log_flush(void)
 {
-  if (logfile) fflush(logfile);
+    if (logfile) fflush(logfile);
 }
 
 void log_puts(const char *str)
 {
-  fflush(stdout);
-  if (logfile) {
-    fputs(str, logfile);
-  }
+    fflush(stdout);
+    if (logfile) {
+        fputs(str, logfile);
+    }
 }
 
 static int
 cp_convert(const char *format, char *buffer, size_t length, int codepage)
 {
-  /* when console output on MSDOS, convert to codepage */
-  const char *input = format;
-  char *pos = buffer;
+    /* when console output on MSDOS, convert to codepage */
+    const char *input = format;
+    char *pos = buffer;
 
-  while (pos + 1 < buffer + length && *input) {
-    size_t length = 0;
-    int result = 0;
-    if (codepage == 437) {
-      result = unicode_utf8_to_cp437(pos, input, &length);
-    } else if (codepage == 1252) {
-      result = unicode_utf8_to_cp1252(pos, input, &length);
+    while (pos + 1 < buffer + length && *input) {
+        size_t length = 0;
+        int result = 0;
+        if (codepage == 437) {
+            result = unicode_utf8_to_cp437(pos, input, &length);
+        }
+        else if (codepage == 1252) {
+            result = unicode_utf8_to_cp1252(pos, input, &length);
+        }
+        if (result != 0) {
+            *pos = 0;                 /* just in case caller ignores our return value */
+            return result;
+        }
+        ++pos;
+        input += length;
     }
-    if (result != 0) {
-      *pos = 0;                 /* just in case caller ignores our return value */
-      return result;
-    }
-    ++pos;
-    input += length;
-  }
-  *pos = 0;
-  return 0;
+    *pos = 0;
+    return 0;
 }
 
 void log_rotate(const char *filename, int maxindex)
 {
-  int n;
-  if (_access(filename, 4)==0) {
-    char buffer[2][MAX_PATH];
-    int src = 1;
-    assert(strlen(filename)<sizeof(buffer[0])-4);
-    for(n=0;n<maxindex;++n) {
-      sprintf(buffer[0], "%s.%d", filename, n);
-      if (_access(filename, 0)!=0) {
-        break;
-      }
+    int n;
+    if (_access(filename, 4) == 0) {
+        char buffer[2][MAX_PATH];
+        int src = 1;
+        assert(strlen(filename) < sizeof(buffer[0]) - 4);
+        for (n = 0; n < maxindex; ++n) {
+            sprintf(buffer[0], "%s.%d", filename, n);
+            if (_access(filename, 0) != 0) {
+                break;
+            }
+        }
+        if (_access(buffer[0], 0) == 0) {
+            unlink(buffer[0]);
+        }
+        while (n--) {
+            int dst = 1 - src;
+            sprintf(buffer[src], "%s.%d", filename, n);
+            rename(buffer[src], buffer[dst]);
+            src = dst;
+        }
+        rename(filename, buffer[1 - src]);
     }
-    if (_access(buffer[0], 0)==0) {
-      unlink(buffer[0]);
-    }
-    while(n--) {
-      int dst = 1-src;
-      sprintf(buffer[src], "%s.%d", filename, n);
-      rename(buffer[src], buffer[dst]);
-      src=dst;
-    }
-    rename(filename, buffer[1-src]);
-  }
 }
 
 void log_open(const char *filename)
 {
-  if (logfile) {
-    log_close();
-  }
-  log_rotate(filename, LOG_MAXBACKUPS);
-  logfile = fopen(filename, "a");
-  if (logfile) {
-    /* Get UNIX-style time and display as number and string. */
-    time_t ltime;
-    time(&ltime);
-    fprintf(logfile, "===\n=== Logfile started at %s===\n", ctime(&ltime));
-  }
+    if (logfile) {
+        log_close();
+    }
+    log_rotate(filename, LOG_MAXBACKUPS);
+    logfile = fopen(filename, "a");
+    if (logfile) {
+        /* Get UNIX-style time and display as number and string. */
+        time_t ltime;
+        time(&ltime);
+        fprintf(logfile, "===\n=== Logfile started at %s===\n", ctime(&ltime));
+    }
 }
 
 void log_close(void)
 {
-  if (!logfile || logfile == stderr || logfile == stdout)
-    return;
-  if (logfile) {
-    /* Get UNIX-style time and display as number and string. */
-    time_t ltime;
-    time(&ltime);
-    fprintf(logfile, "===\n=== Logfile closed at %s===\n\n", ctime(&ltime));
-    fclose(logfile);
-  }
-  logfile = 0;
+    if (!logfile || logfile == stderr || logfile == stdout)
+        return;
+    if (logfile) {
+        /* Get UNIX-style time and display as number and string. */
+        time_t ltime;
+        time(&ltime);
+        fprintf(logfile, "===\n=== Logfile closed at %s===\n\n", ctime(&ltime));
+        fclose(logfile);
+    }
+    logfile = 0;
 }
 
 static int check_dupe(const char *format, const char *type)
 {
-  static const char *last_type; /* STATIC_XCALL: used across calls */
-  static char last_message[32]; /* STATIC_XCALL: used across calls */
-  static int dupes = 0;         /* STATIC_XCALL: used across calls */
-  if (strncmp(last_message, format, sizeof(last_message)) == 0) {
-    ++dupes;
-    return 1;
-  }
-  if (dupes) {
-    if (log_flags & LOG_CPERROR) {
-      fprintf(stderr, "%s: last message repeated %d times\n", last_type,
-        dupes + 1);
+    static const char *last_type; /* STATIC_XCALL: used across calls */
+    static char last_message[32]; /* STATIC_XCALL: used across calls */
+    static int dupes = 0;         /* STATIC_XCALL: used across calls */
+    if (strncmp(last_message, format, sizeof(last_message)) == 0) {
+        ++dupes;
+        return 1;
     }
-    dupes = 0;
-  }
-  strncpy(last_message, format, sizeof(last_message));
-  last_type = type;
-  return 0;
+    if (dupes) {
+        if (log_flags & LOG_CPERROR) {
+            fprintf(stderr, "%s: last message repeated %d times\n", last_type,
+                dupes + 1);
+        }
+        dupes = 0;
+    }
+    strncpy(last_message, format, sizeof(last_message));
+    last_type = type;
+    return 0;
 }
 
 static void _log_write(FILE * stream, int codepage, const char * prefix, const char *format, va_list args)
 {
-  if (stream) {
-    fprintf(stream, "%s: ", prefix);
-    if (codepage) {
-      char buffer[MAXLENGTH];
-      char converted[MAXLENGTH];
+    if (stream) {
+        fprintf(stream, "%s: ", prefix);
+        if (codepage) {
+            char buffer[MAXLENGTH];
+            char converted[MAXLENGTH];
 
-      vsnprintf(buffer, sizeof(buffer), format, args);
-      if (cp_convert(buffer, converted, MAXLENGTH, codepage) == 0) {
-        fputs(converted, stream);
-      } else {
-        /* fall back to non-converted output */
-        vfprintf(stream, format, args);
-      }
-    } else {
-      vfprintf(stream, format, args);
+            vsnprintf(buffer, sizeof(buffer), format, args);
+            if (cp_convert(buffer, converted, MAXLENGTH, codepage) == 0) {
+                fputs(converted, stream);
+            }
+            else {
+                /* fall back to non-converted output */
+                vfprintf(stream, format, args);
+            }
+        }
+        else {
+            vfprintf(stream, format, args);
+        }
     }
-  }
 }
 
 static void _log_writeln(FILE * stream, int codepage, const char * prefix, const char *format, va_list args)
 {
     size_t len = strlen(format);
     _log_write(stream, codepage, prefix, format, args);
-    if (format[len-1]!='\n') {
+    if (format[len - 1] != '\n') {
         fputc('\n', stream);
     }
 }
 void log_debug(const char *format, ...)
 {
-  const char * prefix = "DEBUG";
-  const int mask = LOG_CPDEBUG;
+    const char * prefix = "DEBUG";
+    const int mask = LOG_CPDEBUG;
 
-  /* write to the logfile, always */
-  if (logfile && (log_flags & mask)) {
-    va_list args;
-    va_start(args, format);
-    _log_writeln(logfile, 0, prefix, format, args);
-    va_end(args);
-  }
-
-  /* write to stderr, if that's not the logfile already */
-  if (logfile!=stderr && (log_stderr & mask)) {
-    int dupe = check_dupe(format, prefix);
-    if (!dupe) {
-      va_list args;
-      va_start(args, format);
-      _log_writeln(stderr, stdio_codepage, prefix, format, args);
-      va_end(args);
+    /* write to the logfile, always */
+    if (logfile && (log_flags & mask)) {
+        va_list args;
+        va_start(args, format);
+        _log_writeln(logfile, 0, prefix, format, args);
+        va_end(args);
+    }
+
+    /* write to stderr, if that's not the logfile already */
+    if (logfile != stderr && (log_stderr & mask)) {
+        int dupe = check_dupe(format, prefix);
+        if (!dupe) {
+            va_list args;
+            va_start(args, format);
+            _log_writeln(stderr, stdio_codepage, prefix, format, args);
+            va_end(args);
+        }
+    }
+    if (log_flags & LOG_FLUSH) {
+        log_flush();
     }
-  }
-  if (log_flags & LOG_FLUSH) {
-    log_flush();
-  }
 }
 
 void log_warning(const char *format, ...)
 {
-  const char * prefix = "WARNING";
-  const int mask = LOG_CPWARNING;
+    const char * prefix = "WARNING";
+    const int mask = LOG_CPWARNING;
 
-  /* write to the logfile, always */
-  if (logfile && (log_flags & mask)) {
-    va_list args;
-    va_start(args, format);
-    _log_writeln(logfile, 0, prefix, format, args);
-    va_end(args);
-  }
-
-  /* write to stderr, if that's not the logfile already */
-  if (logfile!=stderr && (log_stderr & mask)) {
-    int dupe = check_dupe(format, prefix);
-    if (!dupe) {
-      va_list args;
-      va_start(args, format);
-      _log_writeln(stderr, stdio_codepage, prefix, format, args);
-      va_end(args);
+    /* write to the logfile, always */
+    if (logfile && (log_flags & mask)) {
+        va_list args;
+        va_start(args, format);
+        _log_writeln(logfile, 0, prefix, format, args);
+        va_end(args);
+    }
+
+    /* write to stderr, if that's not the logfile already */
+    if (logfile != stderr && (log_stderr & mask)) {
+        int dupe = check_dupe(format, prefix);
+        if (!dupe) {
+            va_list args;
+            va_start(args, format);
+            _log_writeln(stderr, stdio_codepage, prefix, format, args);
+            va_end(args);
+        }
+    }
+    if (log_flags & LOG_FLUSH) {
+        log_flush();
     }
-  }
-  if (log_flags & LOG_FLUSH) {
-    log_flush();
-  }
 }
 
 void log_error(const char *format, ...)
 {
-  const char * prefix = "ERROR";
-  const int mask = LOG_CPERROR;
+    const char * prefix = "ERROR";
+    const int mask = LOG_CPERROR;
 
-  /* write to the logfile, always */
-  if (logfile && (log_flags & mask)) {
-    va_list args;
-    va_start(args, format);
-    _log_writeln(logfile, 0, prefix, format, args);
-    va_end(args);
-  }
-
-  /* write to stderr, if that's not the logfile already */
-  if (logfile!=stderr && (log_stderr & mask)) {
-    int dupe = check_dupe(format, prefix);
-    if (!dupe) {
-      va_list args;
-      va_start(args, format);
-      _log_writeln(stderr, stdio_codepage, prefix, format, args);
-      va_end(args);
+    /* write to the logfile, always */
+    if (logfile && (log_flags & mask)) {
+        va_list args;
+        va_start(args, format);
+        _log_writeln(logfile, 0, prefix, format, args);
+        va_end(args);
+    }
+
+    /* write to stderr, if that's not the logfile already */
+    if (logfile != stderr && (log_stderr & mask)) {
+        int dupe = check_dupe(format, prefix);
+        if (!dupe) {
+            va_list args;
+            va_start(args, format);
+            _log_writeln(stderr, stdio_codepage, prefix, format, args);
+            va_end(args);
+        }
+    }
+    if (log_flags & LOG_FLUSH) {
+        log_flush();
     }
-  }
-  if (log_flags & LOG_FLUSH) {
-    log_flush();
-  }
 }
 
 void log_info(const char *format, ...)
 {
-  const char * prefix = "INFO";
-  const int mask = LOG_CPINFO;
+    const char * prefix = "INFO";
+    const int mask = LOG_CPINFO;
 
-  /* write to the logfile, always */
-  if (logfile && (log_flags & mask)) {
-    va_list args;
-    va_start(args, format);
-    _log_writeln(logfile, 0, prefix, format, args);
-    va_end(args);
-  }
-
-  /* write to stderr, if that's not the logfile already */
-  if (logfile!=stderr && (log_stderr & mask)) {
-    int dupe = check_dupe(format, prefix);
-    if (!dupe) {
-      va_list args;
-      va_start(args, format);
-      _log_writeln(stderr, stdio_codepage, prefix, format, args);
-      va_end(args);
+    /* write to the logfile, always */
+    if (logfile && (log_flags & mask)) {
+        va_list args;
+        va_start(args, format);
+        _log_writeln(logfile, 0, prefix, format, args);
+        va_end(args);
+    }
+
+    /* write to stderr, if that's not the logfile already */
+    if (logfile != stderr && (log_stderr & mask)) {
+        int dupe = check_dupe(format, prefix);
+        if (!dupe) {
+            va_list args;
+            va_start(args, format);
+            _log_writeln(stderr, stdio_codepage, prefix, format, args);
+            va_end(args);
+        }
+    }
+    if (log_flags & LOG_FLUSH) {
+        log_flush();
     }
-  }
-  if (log_flags & LOG_FLUSH) {
-    log_flush();
-  }
 }
 
 void log_printf(FILE * io, const char *format, ...)
 {
-  const char * prefix = "INFO";
-  const int mask = LOG_CPINFO;
+    const char * prefix = "INFO";
+    const int mask = LOG_CPINFO;
 
-  /* write to the logfile, always */
-  if (logfile && (log_flags & mask)) {
-    int codepage = (logfile==stderr || logfile==stdout) ? stdio_codepage : 0;
-    va_list args;
-    va_start(args, format);
-    _log_write(logfile, codepage, prefix, format, args);
-    va_end(args);
-  }
-
-  /* write to io, if that's not the logfile already */
-  if (logfile!=io && (log_stderr & mask)) {
-    int dupe = check_dupe(format, prefix);
-    if (!dupe) {
-      va_list args;
-      va_start(args, format);
-      _log_write(io, stdio_codepage, prefix, format, args);
-      va_end(args);
+    /* write to the logfile, always */
+    if (logfile && (log_flags & mask)) {
+        int codepage = (logfile == stderr || logfile == stdout) ? stdio_codepage : 0;
+        va_list args;
+        va_start(args, format);
+        _log_write(logfile, codepage, prefix, format, args);
+        va_end(args);
+    }
+
+    /* write to io, if that's not the logfile already */
+    if (logfile != io && (log_stderr & mask)) {
+        int dupe = check_dupe(format, prefix);
+        if (!dupe) {
+            va_list args;
+            va_start(args, format);
+            _log_write(io, stdio_codepage, prefix, format, args);
+            va_end(args);
+        }
+    }
+    if (log_flags & LOG_FLUSH) {
+        log_flush();
     }
-  }
-  if (log_flags & LOG_FLUSH) {
-    log_flush();
-  }
 }
diff --git a/src/util/log.h b/src/util/log.h
index 41849e533..1e56d4b34 100644
--- a/src/util/log.h
+++ b/src/util/log.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/*
 +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
 |                   |  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -6,7 +6,7 @@
 |                   |  Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
 +-------------------+  Stefan Reich <reich@halbling.de>
 
-This program may not be used, modified or distributed 
+This program may not be used, modified or distributed
 without prior permission by the authors of Eressea.
 */
 #ifndef H_UTIL_LOG
@@ -15,16 +15,16 @@ without prior permission by the authors of Eressea.
 extern "C" {
 #endif
 #include <stdio.h>
-  extern void log_open(const char *filename);
-  extern void log_close(void);
-  extern void log_flush(void);
+    extern void log_open(const char *filename);
+    extern void log_close(void);
+    extern void log_flush(void);
 
-  /* use macros above instead of these: */
-  extern void log_warning(const char *format, ...);
-  extern void log_error(const char *format, ...);
-  extern void log_debug(const char *format, ...);
-  extern void log_info(const char *format, ...);
-  extern void log_printf(FILE * ios, const char *format, ...);
+    /* use macros above instead of these: */
+    extern void log_warning(const char *format, ...);
+    extern void log_error(const char *format, ...);
+    extern void log_debug(const char *format, ...);
+    extern void log_info(const char *format, ...);
+    extern void log_printf(FILE * ios, const char *format, ...);
 
 #define LOG_FLUSH      0x01
 #define LOG_CPWARNING  0x02
@@ -32,8 +32,8 @@ extern "C" {
 #define LOG_CPDEBUG    0x08
 #define LOG_CPINFO     0x10
 
-  extern int log_flags;
-  extern int log_stderr;
+    extern int log_flags;
+    extern int log_stderr;
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/util/message.c b/src/util/message.c
index 79c1949f5..302e8d57c 100644
--- a/src/util/message.c
+++ b/src/util/message.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/*
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -9,7 +9,7 @@
  This program may not be used, modified or distributed
  without prior permission by the authors of Eressea.
 
-*/
+ */
 
 #include <platform.h>
 #include "message.h"
@@ -25,135 +25,137 @@
 #include <string.h>
 #include <stdarg.h>
 
-void (*msg_log_create) (const struct message * msg) = 0;
+void(*msg_log_create) (const struct message * msg) = 0;
 
 const char *mt_name(const message_type * mtype)
 {
-  return mtype->name;
+    return mtype->name;
 }
 
 message_type *mt_new(const char *name, const char *args[])
 {
-  int i, nparameters = 0;
-  message_type *mtype = (message_type *) malloc(sizeof(message_type));
+    int i, nparameters = 0;
+    message_type *mtype = (message_type *)malloc(sizeof(message_type));
 
-  assert(name != NULL);
-  if (name == NULL) {
-    log_error("Trying to create message_type with name=0x0\n");
-    return NULL;
-  }
-  if (args != NULL) {
-    /* count the number of parameters */
-    while (args[nparameters]) ++nparameters;
-  }
-  mtype->key = 0;
-  mtype->name = _strdup(name);
-  mtype->nparameters = nparameters;
-  if (nparameters > 0) {
-    mtype->pnames = (const char **)malloc(sizeof(char *) * nparameters);
-    mtype->types = (const arg_type **)malloc(sizeof(arg_type *) * nparameters);
-  } else {
-    mtype->pnames = NULL;
-    mtype->types = NULL;
-  }
-  if (args != NULL)
-    for (i = 0; args[i]; ++i) {
-      const char *x = args[i];
-      const char *spos = strchr(x, ':');
-      if (spos == NULL) {
-        mtype->pnames[i] = _strdup(x);
-        mtype->types[i] = NULL;
-      } else {
-        char *cp = strncpy((char *)malloc(spos - x + 1), x, spos - x);
-        cp[spos - x] = '\0';
-        mtype->pnames[i] = cp;
-        mtype->types[i] = find_argtype(spos + 1);
-        if (mtype->types[i] == NULL) {
-          log_error("unknown argument type %s for message type %s\n", spos + 1, mtype->name);
-        }
-        assert(mtype->types[i]);
-      }
+    assert(name != NULL);
+    if (name == NULL) {
+        log_error("Trying to create message_type with name=0x0\n");
+        return NULL;
     }
-  return mtype;
+    if (args != NULL) {
+        /* count the number of parameters */
+        while (args[nparameters]) ++nparameters;
+    }
+    mtype->key = 0;
+    mtype->name = _strdup(name);
+    mtype->nparameters = nparameters;
+    if (nparameters > 0) {
+        mtype->pnames = (const char **)malloc(sizeof(char *) * nparameters);
+        mtype->types = (const arg_type **)malloc(sizeof(arg_type *) * nparameters);
+    }
+    else {
+        mtype->pnames = NULL;
+        mtype->types = NULL;
+    }
+    if (args != NULL)
+        for (i = 0; args[i]; ++i) {
+            const char *x = args[i];
+            const char *spos = strchr(x, ':');
+            if (spos == NULL) {
+                mtype->pnames[i] = _strdup(x);
+                mtype->types[i] = NULL;
+            }
+            else {
+                char *cp = strncpy((char *)malloc(spos - x + 1), x, spos - x);
+                cp[spos - x] = '\0';
+                mtype->pnames[i] = cp;
+                mtype->types[i] = find_argtype(spos + 1);
+                if (mtype->types[i] == NULL) {
+                    log_error("unknown argument type %s for message type %s\n", spos + 1, mtype->name);
+                }
+                assert(mtype->types[i]);
+            }
+        }
+    return mtype;
 }
 
 message_type *mt_new_va(const char *name, ...)
 {
-  const char *args[16];
-  int i = 0;
-  va_list marker;
+    const char *args[16];
+    int i = 0;
+    va_list marker;
 
-  va_start(marker, name);
-  for (;;) {
-    const char *c = va_arg(marker, const char *);
-    args[i++] = c;
-    if (c == NULL)
-      break;
-  }
-  va_end(marker);
-  return mt_new(name, args);
+    va_start(marker, name);
+    for (;;) {
+        const char *c = va_arg(marker, const char *);
+        args[i++] = c;
+        if (c == NULL)
+            break;
+    }
+    va_end(marker);
+    return mt_new(name, args);
 }
 
 arg_type *argtypes = NULL;
 
 void
-register_argtype(const char *name, void (*free_arg) (variant),
-  variant(*copy_arg) (variant), variant_type type)
+register_argtype(const char *name, void(*free_arg) (variant),
+variant(*copy_arg) (variant), variant_type type)
 {
-  arg_type *atype = (arg_type *) malloc(sizeof(arg_type));
-  atype->name = name;
-  atype->next = argtypes;
-  atype->release = free_arg;
-  atype->copy = copy_arg;
-  atype->vtype = type;
-  argtypes = atype;
+    arg_type *atype = (arg_type *)malloc(sizeof(arg_type));
+    atype->name = name;
+    atype->next = argtypes;
+    atype->release = free_arg;
+    atype->copy = copy_arg;
+    atype->vtype = type;
+    argtypes = atype;
 }
 
 const arg_type *find_argtype(const char *name)
 {
-  arg_type *atype = argtypes;
-  while (atype != NULL) {
-    if (strcmp(atype->name, name) == 0)
-      return atype;
-    atype = atype->next;
-  }
-  return NULL;
+    arg_type *atype = argtypes;
+    while (atype != NULL) {
+        if (strcmp(atype->name, name) == 0)
+            return atype;
+        atype = atype->next;
+    }
+    return NULL;
 }
 
 static variant copy_arg(const arg_type * atype, variant data)
 {
-  assert(atype != NULL);
-  if (atype->copy == NULL)
-    return data;
-  return atype->copy(data);
+    assert(atype != NULL);
+    if (atype->copy == NULL)
+        return data;
+    return atype->copy(data);
 }
 
 static void free_arg(const arg_type * atype, variant data)
 {
-  assert(atype != NULL);
-  if (atype->release)
-    atype->release(data);
+    assert(atype != NULL);
+    if (atype->release)
+        atype->release(data);
 }
 
 message *msg_create(const struct message_type *mtype, variant args[])
 {
-  int i;
-  message *msg = (message *) malloc(sizeof(message));
+    int i;
+    message *msg = (message *)malloc(sizeof(message));
 
-  assert(mtype != NULL);
-  if (mtype == NULL) {
-    log_error("Trying to create message with type=0x0\n");
-    return NULL;
-  }
-  msg->type = mtype;
-  msg->parameters = (variant *)(mtype->nparameters ? calloc(mtype->nparameters, sizeof(variant)) : NULL);
-  msg->refcount = 1;
-  for (i = 0; i != mtype->nparameters; ++i) {
-    msg->parameters[i] = copy_arg(mtype->types[i], args[i]);
-  }
-  if (msg_log_create)
-    msg_log_create(msg);
-  return msg;
+    assert(mtype != NULL);
+    if (mtype == NULL) {
+        log_error("Trying to create message with type=0x0\n");
+        return NULL;
+    }
+    msg->type = mtype;
+    msg->parameters = (variant *)(mtype->nparameters ? calloc(mtype->nparameters, sizeof(variant)) : NULL);
+    msg->refcount = 1;
+    for (i = 0; i != mtype->nparameters; ++i) {
+        msg->parameters[i] = copy_arg(mtype->types[i], args[i]);
+    }
+    if (msg_log_create)
+        msg_log_create(msg);
+    return msg;
 }
 
 #define MT_MAXHASH 1021
@@ -161,63 +163,63 @@ static quicklist *messagetypes[MT_MAXHASH];
 
 const message_type *mt_find(const char *name)
 {
-  unsigned int hash = hashstring(name) % MT_MAXHASH;
-  quicklist *ql = messagetypes[hash];
-  int qi;
+    unsigned int hash = hashstring(name) % MT_MAXHASH;
+    quicklist *ql = messagetypes[hash];
+    int qi;
 
-  for (qi = 0; ql; ql_advance(&ql, &qi, 1)) {
-    message_type *data = (message_type *) ql_get(ql, qi);
-    if (strcmp(data->name, name) == 0) {
-      return data;
+    for (qi = 0; ql; ql_advance(&ql, &qi, 1)) {
+        message_type *data = (message_type *)ql_get(ql, qi);
+        if (strcmp(data->name, name) == 0) {
+            return data;
+        }
     }
-  }
-  return 0;
+    return 0;
 }
 
 static unsigned int mt_id(const message_type * mtype)
 {
-  unsigned int key = 0;
-  size_t i = strlen(mtype->name);
+    unsigned int key = 0;
+    size_t i = strlen(mtype->name);
 
-  while (i > 0) {
-    key = (mtype->name[--i] + key * 37);
-  }
-  return key % 0x7FFFFFFF;
+    while (i > 0) {
+        key = (mtype->name[--i] + key * 37);
+    }
+    return key % 0x7FFFFFFF;
 }
 
 const message_type *mt_register(message_type * type)
 {
-  unsigned int hash = hashstring(type->name) % MT_MAXHASH;
-  quicklist **qlp = messagetypes + hash;
+    unsigned int hash = hashstring(type->name) % MT_MAXHASH;
+    quicklist **qlp = messagetypes + hash;
 
-  if (ql_set_insert(qlp, type)) {
-    type->key = mt_id(type);
-  }
-  return type;
+    if (ql_set_insert(qlp, type)) {
+        type->key = mt_id(type);
+    }
+    return type;
 }
 
 void msg_free(message * msg)
 {
-  int i;
-  assert(msg->refcount == 0);
-  for (i = 0; i != msg->type->nparameters; ++i) {
-    free_arg(msg->type->types[i], msg->parameters[i]);
-  }
-  free((void *)msg->parameters);
-  free(msg);
+    int i;
+    assert(msg->refcount == 0);
+    for (i = 0; i != msg->type->nparameters; ++i) {
+        free_arg(msg->type->types[i], msg->parameters[i]);
+    }
+    free((void *)msg->parameters);
+    free(msg);
 }
 
 void msg_release(struct message *msg)
 {
-  assert(msg->refcount > 0);
-  if (--msg->refcount > 0)
-    return;
-  msg_free(msg);
+    assert(msg->refcount > 0);
+    if (--msg->refcount > 0)
+        return;
+    msg_free(msg);
 }
 
 struct message *msg_addref(struct message *msg)
 {
-  assert(msg->refcount > 0);
-  ++msg->refcount;
-  return msg;
+    assert(msg->refcount > 0);
+    ++msg->refcount;
+    return msg;
 }
diff --git a/src/util/message.h b/src/util/message.h
index 446e0ffc3..7a9722224 100644
--- a/src/util/message.h
+++ b/src/util/message.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/*
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -6,9 +6,9 @@
  |                   |  Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
  +-------------------+  Stefan Reich <reich@halbling.de>
 
- This program may not be used, modified or distributed 
+ This program may not be used, modified or distributed
  without prior permission by the authors of Eressea.
-*/
+ */
 #ifndef H_MESSAGE_H
 #define H_MESSAGE_H
 
@@ -18,52 +18,52 @@
 extern "C" {
 #endif
 
-  typedef struct arg_type {
-    struct arg_type *next;
-    variant_type vtype;
-    const char *name;
-    void (*release) (variant);
-     variant(*copy) (variant);
-  } arg_type;
+    typedef struct arg_type {
+        struct arg_type *next;
+        variant_type vtype;
+        const char *name;
+        void(*release) (variant);
+        variant(*copy) (variant);
+    } arg_type;
 
-  typedef struct message_type {
-    unsigned int key;
-    const char *name;
-    int nparameters;
-    const char **pnames;
-    const struct arg_type **types;
-  } message_type;
+    typedef struct message_type {
+        unsigned int key;
+        const char *name;
+        int nparameters;
+        const char **pnames;
+        const struct arg_type **types;
+    } message_type;
 
-  typedef struct message {
-    const struct message_type *type;
-    variant *parameters;
-    int refcount;
-  } message;
+    typedef struct message {
+        const struct message_type *type;
+        variant *parameters;
+        int refcount;
+    } message;
 
-  extern struct message_type *mt_new(const char *name, const char **args);
-  extern struct message_type *mt_new_va(const char *name, ...);
-  /* mt_new("simple_sentence", "subject:string", "predicate:string", 
-   *        "object:string", "lang:locale", NULL); */
+    extern struct message_type *mt_new(const char *name, const char **args);
+    extern struct message_type *mt_new_va(const char *name, ...);
+    /* mt_new("simple_sentence", "subject:string", "predicate:string",
+     *        "object:string", "lang:locale", NULL); */
 
-  extern struct message *msg_create(const struct message_type *type,
-    variant args[]);
-  /* msg_create(&mt_simplesentence, "enno", "eats", "chocolate", &locale_de); 
-   * parameters must be in the same order as they were for mt_new! */
+    extern struct message *msg_create(const struct message_type *type,
+        variant args[]);
+    /* msg_create(&mt_simplesentence, "enno", "eats", "chocolate", &locale_de);
+     * parameters must be in the same order as they were for mt_new! */
 
-  extern void msg_release(struct message *msg);
-  extern struct message *msg_addref(struct message *msg);
+    extern void msg_release(struct message *msg);
+    extern struct message *msg_addref(struct message *msg);
 
-  extern const char *mt_name(const struct message_type *mtype);
+    extern const char *mt_name(const struct message_type *mtype);
 
-/** message_type registry (optional): **/
-  extern const struct message_type *mt_register(struct message_type *);
-  extern const struct message_type *mt_find(const char *);
+    /** message_type registry (optional): **/
+    extern const struct message_type *mt_register(struct message_type *);
+    extern const struct message_type *mt_find(const char *);
 
-  extern void register_argtype(const char *name, void (*free_arg) (variant),
-    variant(*copy_arg) (variant), variant_type);
-  extern const struct arg_type *find_argtype(const char *name);
+    extern void register_argtype(const char *name, void(*free_arg) (variant),
+        variant(*copy_arg) (variant), variant_type);
+    extern const struct arg_type *find_argtype(const char *name);
 
-  extern void (*msg_log_create) (const struct message * msg);
+    extern void(*msg_log_create) (const struct message * msg);
 
 #ifdef __cplusplus
 }
diff --git a/src/util/nrmessage.c b/src/util/nrmessage.c
index adc0e1e53..5543b87ef 100644
--- a/src/util/nrmessage.c
+++ b/src/util/nrmessage.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/*
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -9,7 +9,7 @@
  This program may not be used, modified or distributed
  without prior permission by the authors of Eressea.
 
-*/
+ */
 
 #include <platform.h>
 #include "nrmessage.h"
@@ -33,145 +33,148 @@ static nrmessage_type *nrtypes[NRT_MAXHASH];
 
 const char *nrt_string(const struct nrmessage_type *type)
 {
-  return type->string;
+    return type->string;
 }
 
 nrmessage_type *nrt_find(const struct locale * lang,
-  const struct message_type * mtype)
+    const struct message_type * mtype)
 {
-  nrmessage_type *found = NULL;
-  unsigned int hash = hashstring(mtype->name) % NRT_MAXHASH;
-  nrmessage_type *type = nrtypes[hash];
-  while (type) {
-    if (type->mtype == mtype) {
-      if (found == NULL)
-        found = type;
-      else if (type->lang == NULL)
-        found = type;
-      if (lang == type->lang) {
-        found = type;
-        break;
-      }
+    nrmessage_type *found = NULL;
+    unsigned int hash = hashstring(mtype->name) % NRT_MAXHASH;
+    nrmessage_type *type = nrtypes[hash];
+    while (type) {
+        if (type->mtype == mtype) {
+            if (found == NULL)
+                found = type;
+            else if (type->lang == NULL)
+                found = type;
+            if (lang == type->lang) {
+                found = type;
+                break;
+            }
+        }
+        type = type->next;
     }
-    type = type->next;
-  }
-  if (!found) {
-    log_warning("could not find nr-type %s for locale %s\n", mtype->name, locale_name(lang));
-  }
-  if (lang && found && found->lang != lang) {
-    log_warning("could not find nr-type %s for locale %s, using %s\n", mtype->name, locale_name(lang), locale_name(found->lang));
-  }
-  return found;
+    if (!found) {
+        log_warning("could not find nr-type %s for locale %s\n", mtype->name, locale_name(lang));
+    }
+    if (lang && found && found->lang != lang) {
+        log_warning("could not find nr-type %s for locale %s, using %s\n", mtype->name, locale_name(lang), locale_name(found->lang));
+    }
+    return found;
 }
 
 nrsection *sections;
 
 const nrsection *section_find(const char *name)
 {
-  nrsection **mcp = &sections;
-  if (name == NULL)
-    return NULL;
-  for (; *mcp; mcp = &(*mcp)->next) {
-    nrsection *mc = *mcp;
-    if (!strcmp(mc->name, name))
-      break;
-  }
-  return *mcp;
+    nrsection **mcp = &sections;
+    if (name == NULL)
+        return NULL;
+    for (; *mcp; mcp = &(*mcp)->next) {
+        nrsection *mc = *mcp;
+        if (!strcmp(mc->name, name))
+            break;
+    }
+    return *mcp;
 }
 
 const nrsection *section_add(const char *name)
 {
-  nrsection **mcp = &sections;
-  if (name == NULL)
-    return NULL;
-  for (; *mcp; mcp = &(*mcp)->next) {
-    nrsection *mc = *mcp;
-    if (!strcmp(mc->name, name))
-      break;
-  }
-  if (!*mcp) {
-    nrsection *mc = calloc(sizeof(nrsection), 1);
-    mc->name = _strdup(name);
-    *mcp = mc;
-  }
-  return *mcp;
+    nrsection **mcp = &sections;
+    if (name == NULL)
+        return NULL;
+    for (; *mcp; mcp = &(*mcp)->next) {
+        nrsection *mc = *mcp;
+        if (!strcmp(mc->name, name))
+            break;
+    }
+    if (!*mcp) {
+        nrsection *mc = calloc(sizeof(nrsection), 1);
+        mc->name = _strdup(name);
+        *mcp = mc;
+    }
+    return *mcp;
 }
 
 void
 nrt_register(const struct message_type *mtype, const struct locale *lang,
-  const char *string, int level, const char *section)
+const char *string, int level, const char *section)
 {
-  unsigned int hash = hashstring(mtype->name) % NRT_MAXHASH;
-  nrmessage_type *nrt = nrtypes[hash];
-  while (nrt && (nrt->lang != lang || nrt->mtype != mtype)) {
-    nrt = nrt->next;
-  }
-  if (nrt) {
-    log_error("duplicate message-type %s\n", mtype->name);
-    assert(!nrt || !"trying to register same nr-type twice");
-  } else {
-    int i;
-    char zNames[256];
-    char *c = zNames;
-    nrt = malloc(sizeof(nrmessage_type));
-    nrt->lang = lang;
-    nrt->mtype = mtype;
-    nrt->next = nrtypes[hash];
-    nrt->level = level;
-    if (section) {
-      const nrsection *s = section_find(section);
-      if (s == NULL) {
-        s = section_add(section);
-      }
-      nrt->section = s->name;
-    } else
-      nrt->section = NULL;
-    nrtypes[hash] = nrt;
-    assert(string && *string);
-    nrt->string = _strdup(string);
-    *c = '\0';
-    for (i = 0; i != mtype->nparameters; ++i) {
-      if (i != 0)
-        *c++ = ' ';
-      c += strlen(strcpy(c, mtype->pnames[i]));
+    unsigned int hash = hashstring(mtype->name) % NRT_MAXHASH;
+    nrmessage_type *nrt = nrtypes[hash];
+    while (nrt && (nrt->lang != lang || nrt->mtype != mtype)) {
+        nrt = nrt->next;
+    }
+    if (nrt) {
+        log_error("duplicate message-type %s\n", mtype->name);
+        assert(!nrt || !"trying to register same nr-type twice");
+    }
+    else {
+        int i;
+        char zNames[256];
+        char *c = zNames;
+        nrt = malloc(sizeof(nrmessage_type));
+        nrt->lang = lang;
+        nrt->mtype = mtype;
+        nrt->next = nrtypes[hash];
+        nrt->level = level;
+        if (section) {
+            const nrsection *s = section_find(section);
+            if (s == NULL) {
+                s = section_add(section);
+            }
+            nrt->section = s->name;
+        }
+        else
+            nrt->section = NULL;
+        nrtypes[hash] = nrt;
+        assert(string && *string);
+        nrt->string = _strdup(string);
+        *c = '\0';
+        for (i = 0; i != mtype->nparameters; ++i) {
+            if (i != 0)
+                *c++ = ' ';
+            c += strlen(strcpy(c, mtype->pnames[i]));
+        }
+        nrt->vars = _strdup(zNames);
     }
-    nrt->vars = _strdup(zNames);
-  }
 }
 
 size_t
 nr_render(const struct message *msg, const struct locale *lang, char *buffer,
-  size_t size, const void *userdata)
+size_t size, const void *userdata)
 {
-  struct nrmessage_type *nrt = nrt_find(lang, msg->type);
+    struct nrmessage_type *nrt = nrt_find(lang, msg->type);
 
-  if (nrt) {
-    const char *m =
-      translate(nrt->string, userdata, nrt->vars, msg->parameters);
-    if (m) {
-      return strlcpy((char *)buffer, m, size);
-    } else {
-      log_error("Couldn't render message %s\n", nrt->mtype->name);
+    if (nrt) {
+        const char *m =
+            translate(nrt->string, userdata, nrt->vars, msg->parameters);
+        if (m) {
+            return strlcpy((char *)buffer, m, size);
+        }
+        else {
+            log_error("Couldn't render message %s\n", nrt->mtype->name);
+        }
     }
-  }
-  if (size > 0 && buffer)
-    buffer[0] = 0;
-  return 0;
+    if (size > 0 && buffer)
+        buffer[0] = 0;
+    return 0;
 }
 
 int nr_level(const struct message *msg)
 {
-  nrmessage_type *nrt = nrt_find(NULL, msg->type);
-  return nrt ? nrt->level : 0;
+    nrmessage_type *nrt = nrt_find(NULL, msg->type);
+    return nrt ? nrt->level : 0;
 }
 
 const char *nr_section(const struct message *msg)
 {
-  nrmessage_type *nrt = nrt_find(default_locale, msg->type);
-  return nrt ? nrt->section : NULL;
+    nrmessage_type *nrt = nrt_find(default_locale, msg->type);
+    return nrt ? nrt->section : NULL;
 }
 
 const char *nrt_section(const nrmessage_type * nrt)
 {
-  return nrt ? nrt->section : NULL;
+    return nrt ? nrt->section : NULL;
 }
diff --git a/src/util/nrmessage.h b/src/util/nrmessage.h
index 1c8781d41..5d775be9e 100644
--- a/src/util/nrmessage.h
+++ b/src/util/nrmessage.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/*
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -8,7 +8,7 @@
 
  This program may not be used, modified or distributed
  without prior permission by the authors of Eressea.
-*/
+ */
 
 #ifndef H_UTIL_NRMESSAGE
 #define H_UTIL_NRMESSAGE
@@ -16,38 +16,38 @@
 extern "C" {
 #endif
 
-  struct locale;
-  struct message;
-  struct message_type;
-  struct nrmessage_type;
+    struct locale;
+    struct message;
+    struct message_type;
+    struct nrmessage_type;
 
-  typedef struct nrsection {
-    char *name;
-    struct nrsection *next;
-  } nrsection;
+    typedef struct nrsection {
+        char *name;
+        struct nrsection *next;
+    } nrsection;
 
-  extern nrsection *sections;
+    extern nrsection *sections;
 
-  extern void nrt_register(const struct message_type *mtype,
-    const struct locale *lang, const char *script,
-    int level, const char *section);
-  extern struct nrmessage_type *nrt_find(const struct locale *,
-    const struct message_type *);
-  extern const char *nrt_string(const struct nrmessage_type *type);
-  extern const char *nrt_section(const struct nrmessage_type *mt);
+    extern void nrt_register(const struct message_type *mtype,
+        const struct locale *lang, const char *script,
+        int level, const char *section);
+    extern struct nrmessage_type *nrt_find(const struct locale *,
+        const struct message_type *);
+    extern const char *nrt_string(const struct nrmessage_type *type);
+    extern const char *nrt_section(const struct nrmessage_type *mt);
 
-  extern size_t nr_render(const struct message *msg, const struct locale *lang,
-    char *buffer, size_t size, const void *userdata);
-  extern int nr_level(const struct message *msg);
-  extern const char *nr_section(const struct message *msg);
+    extern size_t nr_render(const struct message *msg, const struct locale *lang,
+        char *buffer, size_t size, const void *userdata);
+    extern int nr_level(const struct message *msg);
+    extern const char *nr_section(const struct message *msg);
 
-/* before:
- * fogblock;movement:0;de;{unit} konnte von {region} nicht nach {$dir direction} ausreisen, der Nebel war zu dicht.
- * after:
- * fogblock:movement:0
- * $unit($unit) konnte von $region($region) nicht nach $direction($direction) ausreisen, der Nebel war zu dicht.
- * unit:unit region:region direction:int
- */
+    /* before:
+     * fogblock;movement:0;de;{unit} konnte von {region} nicht nach {$dir direction} ausreisen, der Nebel war zu dicht.
+     * after:
+     * fogblock:movement:0
+     * $unit($unit) konnte von $region($region) nicht nach $direction($direction) ausreisen, der Nebel war zu dicht.
+     * unit:unit region:region direction:int
+     */
 
 #ifdef __cplusplus
 }
diff --git a/src/util/parser.c b/src/util/parser.c
index b927a99a0..63b293e82 100644
--- a/src/util/parser.c
+++ b/src/util/parser.c
@@ -14,62 +14,63 @@
 #define MAXTOKENSIZE      8192
 
 typedef struct parser_state {
-  const char *current_token;
-  struct parser_state *next;
+    const char *current_token;
+    struct parser_state *next;
 } parser_state;
 
 static parser_state *states;
 
 static int eatwhitespace_c(const char **str_p)
 {
-  int ret = 0;
-  ucs4_t ucs;
-  size_t len;
-  const char *str = *str_p;
+    int ret = 0;
+    ucs4_t ucs;
+    size_t len;
+    const char *str = *str_p;
 
-  /* skip over potential whitespace */
-  for (;;) {
-    unsigned char utf8_character = (unsigned char)*str;
-    if (~utf8_character & 0x80) {
-      if (!iswxspace(utf8_character))
-        break;
-      ++str;
-    } else {
-      ret = unicode_utf8_to_ucs4(&ucs, str, &len);
-      if (ret != 0) {
-        log_warning("illegal character sequence in UTF8 string: %s\n", str);
-        break;
-      }
-      if (!iswxspace((wint_t) ucs))
-        break;
-      str += len;
+    /* skip over potential whitespace */
+    for (;;) {
+        unsigned char utf8_character = (unsigned char)*str;
+        if (~utf8_character & 0x80) {
+            if (!iswxspace(utf8_character))
+                break;
+            ++str;
+        }
+        else {
+            ret = unicode_utf8_to_ucs4(&ucs, str, &len);
+            if (ret != 0) {
+                log_warning("illegal character sequence in UTF8 string: %s\n", str);
+                break;
+            }
+            if (!iswxspace((wint_t)ucs))
+                break;
+            str += len;
+        }
     }
-  }
-  *str_p = str;
-  return ret;
+    *str_p = str;
+    return ret;
 }
 
 void init_tokens_str(const char *initstr)
 {
-  if (states == NULL) {
-    states = malloc(sizeof(parser_state));
-  }
-  states->current_token = initstr;
+    if (states == NULL) {
+        states = malloc(sizeof(parser_state));
+    }
+    states->current_token = initstr;
 }
 
 void parser_pushstate(void)
 {
-  parser_state *new_state = malloc(sizeof(parser_state));
-  new_state->current_token = NULL;
-  new_state->next = states;
-  states = new_state;
+    parser_state *new_state = malloc(sizeof(parser_state));
+    new_state->current_token = NULL;
+    new_state->next = states;
+    states = new_state;
 }
 
 void parser_popstate(void)
 {
-  parser_state *new_state = states->next;
-  free(states);
-  states = new_state;
+    parser_state *new_state = states->next;
+    free(states);
+    states = new_state;
 }
 
 bool parser_end(void)
@@ -83,41 +84,44 @@ bool parser_end(void)
 
 void skip_token(void)
 {
-  char quotechar = 0;
-  eatwhitespace_c(&states->current_token);
+    char quotechar = 0;
+    eatwhitespace_c(&states->current_token);
 
-  while (*states->current_token) {
-    ucs4_t ucs;
-    size_t len;
+    while (*states->current_token) {
+        ucs4_t ucs;
+        size_t len;
 
-    unsigned char utf8_character = (unsigned char)states->current_token[0];
-    if (~utf8_character & 0x80) {
-      ucs = utf8_character;
-      ++states->current_token;
-    } else {
-      int ret = unicode_utf8_to_ucs4(&ucs, states->current_token, &len);
-      if (ret == 0) {
-        states->current_token += len;
-      } else {
-        log_warning("illegal character sequence in UTF8 string: %s\n", states->current_token);
-      }
-    }
-    if (iswxspace((wint_t) ucs) && quotechar == 0) {
-      return;
-    } else {
-      switch (utf8_character) {
-        case '"':
-        case '\'':
-          if (utf8_character == quotechar)
+        unsigned char utf8_character = (unsigned char)states->current_token[0];
+        if (~utf8_character & 0x80) {
+            ucs = utf8_character;
+            ++states->current_token;
+        }
+        else {
+            int ret = unicode_utf8_to_ucs4(&ucs, states->current_token, &len);
+            if (ret == 0) {
+                states->current_token += len;
+            }
+            else {
+                log_warning("illegal character sequence in UTF8 string: %s\n", states->current_token);
+            }
+        }
+        if (iswxspace((wint_t)ucs) && quotechar == 0) {
             return;
-          quotechar = utf8_character;
-          break;
-        case ESCAPE_CHAR:
-          ++states->current_token;
-          break;
-      }
+        }
+        else {
+            switch (utf8_character) {
+            case '"':
+            case '\'':
+                if (utf8_character == quotechar)
+                    return;
+                quotechar = utf8_character;
+                break;
+            case ESCAPE_CHAR:
+                ++states->current_token;
+                break;
+            }
+        }
     }
-  }
 }
 
 char *parse_token(const char **str, char *lbuf, size_t buflen)
@@ -204,7 +208,7 @@ char *parse_token(const char **str, char *lbuf, size_t buflen)
 static char pbuf[MAXTOKENSIZE];       /* STATIC_RESULT: used for return, not across calls */
 const char *parse_token_depr(const char **str)
 {
-  return parse_token(str, pbuf, MAXTOKENSIZE);
+    return parse_token(str, pbuf, MAXTOKENSIZE);
 }
 
 const char *getstrtoken(void)
diff --git a/src/util/parser.h b/src/util/parser.h
index 01804ab01..839968480 100644
--- a/src/util/parser.h
+++ b/src/util/parser.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  * +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  * |                   |  Enno Rehling <enno@eressea.de>
  * | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
diff --git a/src/util/rand.c b/src/util/rand.c
index b26bf0c12..5b305d974 100644
--- a/src/util/rand.c
+++ b/src/util/rand.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -34,36 +34,36 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */
 double normalvariate(double mu, double sigma)
 {
-  static const double NV_MAGICCONST = 1.7155277699214135;       /* STATIC_CONST: a constant */
-  double z;
-  for (;;) {
-    double u1 = rng_double();
-    double u2 = 1.0 - rng_double();
-    z = NV_MAGICCONST * (u1 - 0.5) / u2;
-    if (z * z / 4.0 <= -log(u2)) {
-      break;
+    static const double NV_MAGICCONST = 1.7155277699214135;       /* STATIC_CONST: a constant */
+    double z;
+    for (;;) {
+        double u1 = rng_double();
+        double u2 = 1.0 - rng_double();
+        z = NV_MAGICCONST * (u1 - 0.5) / u2;
+        if (z * z / 4.0 <= -log(u2)) {
+            break;
+        }
     }
-  }
-  return mu + z * sigma;
+    return mu + z * sigma;
 }
 
 int ntimespprob(int n, double p, double mod)
 {
-  int count = 0;
-  int i;
+    int count = 0;
+    int i;
 
-  for (i = 0; i < n && p > 0; i++) {
-    if (rng_double() < p) {
-      count++;
-      p += mod;
+    for (i = 0; i < n && p > 0; i++) {
+        if (rng_double() < p) {
+            count++;
+            p += mod;
+        }
     }
-  }
-  return count;
+    return count;
 }
 
 bool chance(double x)
 {
-  if (x >= 1.0)
-    return true;
-  return rng_double() < x;
+    if (x >= 1.0)
+        return true;
+    return rng_double() < x;
 }
diff --git a/src/util/rand.h b/src/util/rand.h
index 9223923b9..233f2ee92 100644
--- a/src/util/rand.h
+++ b/src/util/rand.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -22,14 +22,14 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 extern "C" {
 #endif
 
-  /* in dice.c: */
-  extern int dice_rand(const char *str);
-  extern int dice(int count, int value);
+    /* in dice.c: */
+    extern int dice_rand(const char *str);
+    extern int dice(int count, int value);
 
-  /* in rand.c: */
-  extern double normalvariate(double mu, double sigma);
-  extern int ntimespprob(int n, double p, double mod);
-  extern bool chance(double x);
+    /* in rand.c: */
+    extern double normalvariate(double mu, double sigma);
+    extern int ntimespprob(int n, double p, double mod);
+    extern bool chance(double x);
 
 #ifdef __cplusplus
 }
diff --git a/src/util/resolve.c b/src/util/resolve.c
index 7f28c942a..2d30b2936 100644
--- a/src/util/resolve.c
+++ b/src/util/resolve.c
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -24,12 +24,12 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include "variant.h"
 
 typedef struct unresolved {
-  void *ptrptr;
-  /* address to pass to the resolve-function */
-  variant data;
-  /* information on how to resolve the missing object */
-  resolve_fun resolve;
-  /* function to resolve the unknown object */
+    void *ptrptr;
+    /* address to pass to the resolve-function */
+    variant data;
+    /* information on how to resolve the missing object */
+    resolve_fun resolve;
+    /* function to resolve the unknown object */
 } unresolved;
 
 #define BLOCKSIZE 1024
@@ -39,55 +39,56 @@ static unresolved *ur_current;
 
 variant read_int(struct storage *store)
 {
-  variant var;
-  READ_INT(store, &var.i);
-  return var;
+    variant var;
+    READ_INT(store, &var.i);
+    return var;
 }
 
 int
 read_reference(void *address, storage * store, read_fun reader,
-  resolve_fun resolver)
+resolve_fun resolver)
 {
-  variant var = reader(store);
-  int result = resolver(var, address);
-  if (result != 0) {
-    ur_add(var, address, resolver);
-  }
-  return result;
+    variant var = reader(store);
+    int result = resolver(var, address);
+    if (result != 0) {
+        ur_add(var, address, resolver);
+    }
+    return result;
 }
 
 void ur_add(variant data, void *ptrptr, resolve_fun fun)
 {
-  if (ur_list == NULL) {
-    ur_list = malloc(BLOCKSIZE * sizeof(unresolved));
-    ur_begin = ur_current = ur_list;
-  } else if (ur_current - ur_begin == BLOCKSIZE - 1) {
-    ur_begin = malloc(BLOCKSIZE * sizeof(unresolved));
-    ur_current->data.v = ur_begin;
-    ur_current = ur_begin;
-  }
-  ur_current->data = data;
-  ur_current->resolve = fun;
-  ur_current->ptrptr = ptrptr;
+    if (ur_list == NULL) {
+        ur_list = malloc(BLOCKSIZE * sizeof(unresolved));
+        ur_begin = ur_current = ur_list;
+    }
+    else if (ur_current - ur_begin == BLOCKSIZE - 1) {
+        ur_begin = malloc(BLOCKSIZE * sizeof(unresolved));
+        ur_current->data.v = ur_begin;
+        ur_current = ur_begin;
+    }
+    ur_current->data = data;
+    ur_current->resolve = fun;
+    ur_current->ptrptr = ptrptr;
 
-  ++ur_current;
-  ur_current->resolve = NULL;
-  ur_current->data.v = NULL;
+    ++ur_current;
+    ur_current->resolve = NULL;
+    ur_current->data.v = NULL;
 }
 
 void resolve(void)
 {
-  unresolved *ur = ur_list;
-  while (ur) {
-    if (ur->resolve == NULL) {
-      ur = ur->data.v;
-      free(ur_list);
-      ur_list = ur;
-      continue;
+    unresolved *ur = ur_list;
+    while (ur) {
+        if (ur->resolve == NULL) {
+            ur = ur->data.v;
+            free(ur_list);
+            ur_list = ur;
+            continue;
+        }
+        ur->resolve(ur->data, ur->ptrptr);
+        ++ur;
     }
-    ur->resolve(ur->data, ur->ptrptr);
-    ++ur;
-  }
-  free(ur_list);
-  ur_list = NULL;
+    free(ur_list);
+    ur_list = NULL;
 }
diff --git a/src/util/resolve.h b/src/util/resolve.h
index 64b9441a6..fad4d8d1e 100644
--- a/src/util/resolve.h
+++ b/src/util/resolve.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -26,15 +26,15 @@ struct storage;
 extern "C" {
 #endif
 
-  typedef int (*resolve_fun) (variant data, void *address);
-  typedef variant(*read_fun) (struct storage * store);
-  extern int read_reference(void *address, struct storage *store,
-    read_fun reader, resolve_fun resolver);
+    typedef int(*resolve_fun) (variant data, void *address);
+    typedef variant(*read_fun) (struct storage * store);
+    extern int read_reference(void *address, struct storage *store,
+        read_fun reader, resolve_fun resolver);
 
-  extern void ur_add(variant data, void *address, resolve_fun fun);
-  extern void resolve(void);
+    extern void ur_add(variant data, void *address, resolve_fun fun);
+    extern void resolve(void);
 
-  extern variant read_int(struct storage *store);
+    extern variant read_int(struct storage *store);
 
 #ifdef __cplusplus
 }
diff --git a/src/util/rng.h b/src/util/rng.h
index 8737190c6..32dbcaeab 100644
--- a/src/util/rng.h
+++ b/src/util/rng.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  * +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  * |                   |  Enno Rehling <enno@eressea.de>
  * | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
diff --git a/src/util/strings.c b/src/util/strings.c
index 4c72e0913..22a787f93 100644
--- a/src/util/strings.c
+++ b/src/util/strings.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/util/translation.c b/src/util/translation.c
index b384acc64..804aaf4c0 100644
--- a/src/util/translation.c
+++ b/src/util/translation.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -6,9 +6,9 @@
  |                   |  Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
  +-------------------+  Stefan Reich <reich@halbling.de>
 
- This program may not be used, modified or distributed 
+ This program may not be used, modified or distributed
  without prior permission by the authors of Eressea.
-*/
+ */
 #include <platform.h>
 
 #include "translation.h"
@@ -29,80 +29,80 @@
  **/
 
 typedef struct opstack {
-  variant *begin;
-  variant *top;
-  int size;
+    variant *begin;
+    variant *top;
+    int size;
 } opstack;
 
 variant opstack_pop(opstack ** stackp)
 {
-  opstack *stack = *stackp;
+    opstack *stack = *stackp;
 
-  assert(stack);
-  assert(stack->top > stack->begin);
-  return *(--stack->top);
+    assert(stack);
+    assert(stack->top > stack->begin);
+    return *(--stack->top);
 }
 
 void opstack_push(opstack ** stackp, variant data)
 {
-  opstack *stack = *stackp;
-  if (stack == NULL) {
-    stack = (opstack *) malloc(sizeof(opstack));
-    stack->size = 2;
-    stack->begin = malloc(sizeof(variant) * stack->size);
-    stack->top = stack->begin;
-    *stackp = stack;
-  }
-  if (stack->top - stack->begin == stack->size) {
-    size_t pos = stack->top - stack->begin;
-    stack->size += stack->size;
-    stack->begin = realloc(stack->begin, sizeof(variant) * stack->size);
-    stack->top = stack->begin + pos;
-  }
-  *stack->top++ = data;
+    opstack *stack = *stackp;
+    if (stack == NULL) {
+        stack = (opstack *)malloc(sizeof(opstack));
+        stack->size = 2;
+        stack->begin = malloc(sizeof(variant) * stack->size);
+        stack->top = stack->begin;
+        *stackp = stack;
+    }
+    if (stack->top - stack->begin == stack->size) {
+        size_t pos = stack->top - stack->begin;
+        stack->size += stack->size;
+        stack->begin = realloc(stack->begin, sizeof(variant) * stack->size);
+        stack->top = stack->begin + pos;
+    }
+    *stack->top++ = data;
 }
 
 /**
- ** static buffer malloc 
+ ** static buffer malloc
  **/
 
 #define BBUFSIZE 128*1024
 static struct {
-  char *begin;
-  char *end;
-  char *last;
-  char *current;
+    char *begin;
+    char *end;
+    char *last;
+    char *current;
 } buffer;
 
 char *balloc(size_t size)
 {
-  static int init = 0;          /* STATIC_XCALL: used across calls */
-  if (!init) {
-    init = 1;
-    buffer.current = buffer.begin = malloc(BBUFSIZE);
-    buffer.end = buffer.begin + BBUFSIZE;
-  }
-  if (buffer.current + size > buffer.end) {
-    /* out of memory! */
-    return NULL;
-  }
-  buffer.last = buffer.current;
-  buffer.current += size;
-  return buffer.last;
+    static int init = 0;          /* STATIC_XCALL: used across calls */
+    if (!init) {
+        init = 1;
+        buffer.current = buffer.begin = malloc(BBUFSIZE);
+        buffer.end = buffer.begin + BBUFSIZE;
+    }
+    if (buffer.current + size > buffer.end) {
+        /* out of memory! */
+        return NULL;
+    }
+    buffer.last = buffer.current;
+    buffer.current += size;
+    return buffer.last;
 }
 
 void bfree(char *c)
-/* only release this memory if it was part of the last allocation 
+/* only release this memory if it was part of the last allocation
  * that's a joke, but who cares.
  */
 {
-  if (c >= buffer.last && c < buffer.current)
-    buffer.current = c;
+    if (c >= buffer.last && c < buffer.current)
+        buffer.current = c;
 }
 
 void brelease(void)
 {
-  buffer.last = buffer.current = buffer.begin;
+    buffer.last = buffer.current = buffer.begin;
 }
 
 /**
@@ -110,38 +110,38 @@ void brelease(void)
  **/
 
 typedef struct variable {
-  struct variable *next;
-  const char *symbol;
-  variant value;
+    struct variable *next;
+    const char *symbol;
+    variant value;
 } variable;
 
 static variable *variables;
 
 static void free_variables(void)
 {
-  variables = NULL;
+    variables = NULL;
 }
 
 static void add_variable(const char *symbol, variant value)
 {
-  variable *var = (variable *) balloc(sizeof(variable));
+    variable *var = (variable *)balloc(sizeof(variable));
 
-  var->value = value;
-  var->symbol = symbol;
+    var->value = value;
+    var->symbol = symbol;
 
-  var->next = variables;
-  variables = var;
+    var->next = variables;
+    variables = var;
 }
 
 static variable *find_variable(const char *symbol)
 {
-  variable *var = variables;
-  while (var) {
-    if (!strcmp(var->symbol, symbol))
-      break;
-    var = var->next;
-  }
-  return var;
+    variable *var = variables;
+    while (var) {
+        if (!strcmp(var->symbol, symbol))
+            break;
+        var = var->next;
+    }
+    return var;
 }
 
 /**
@@ -152,327 +152,332 @@ static struct critbit_tree functions = { 0 };
 
 static void free_functions(void)
 {
-  cb_clear(&functions);
-  functions.root = 0;
+    cb_clear(&functions);
+    functions.root = 0;
 }
 
 void add_function(const char *symbol, evalfun parse)
 {
-  char buffer[64];
-  size_t len = strlen(symbol);
-  
-  assert(len+1+sizeof(parse)<=sizeof(buffer));
-  len = cb_new_kv(symbol, len, &parse, sizeof(parse), buffer);
-  cb_insert(&functions, buffer, len);
+    char buffer[64];
+    size_t len = strlen(symbol);
+
+    assert(len + 1 + sizeof(parse) <= sizeof(buffer));
+    len = cb_new_kv(symbol, len, &parse, sizeof(parse), buffer);
+    cb_insert(&functions, buffer, len);
 }
 
 static evalfun find_function(const char *symbol)
 {
-  const void * matches;
-  if (cb_find_prefix(&functions, symbol, strlen(symbol)+1, &matches, 1, 0)) {
-    evalfun result;
-    cb_get_kv(matches, &result, sizeof(result));
-    return result;
-  }
-  return 0;
+    const void * matches;
+    if (cb_find_prefix(&functions, symbol, strlen(symbol) + 1, &matches, 1, 0)) {
+        evalfun result;
+        cb_get_kv(matches, &result, sizeof(result));
+        return result;
+    }
+    return 0;
 }
 
 static const char *parse(opstack **, const char *in, const void *);
 /* static const char * sample = "\"enno and $bool($if($eq($i,0),\"noone else\",\"$i other people\"))\""; */
 
 static const char *parse_symbol(opstack ** stack, const char *in,
-  const void *userdata)
-/* in is the symbol name and following text, starting after the $ 
- * result goes on the stack
- */
+    const void *userdata)
+    /* in is the symbol name and following text, starting after the $
+     * result goes on the stack
+     */
 {
-  bool braces = false;
-  char symbol[32];
-  char *cp = symbol;            /* current position */
+    bool braces = false;
+    char symbol[32];
+    char *cp = symbol;            /* current position */
 
-  if (*in == '{') {
-    braces = true;
-    ++in;
-  }
-  while (isalnum(*in) || *in == '.')
-    *cp++ = *in++;
-  *cp = '\0';
-  /* symbol will now contain the symbol name */
-  if (*in == '(') {
-    /* it's a function we need to parse, start by reading the parameters */
-    evalfun foo;
+    if (*in == '{') {
+        braces = true;
+        ++in;
+    }
+    while (isalnum(*in) || *in == '.')
+        *cp++ = *in++;
+    *cp = '\0';
+    /* symbol will now contain the symbol name */
+    if (*in == '(') {
+        /* it's a function we need to parse, start by reading the parameters */
+        evalfun foo;
 
-    while (*in != ')') {
-      in = parse(stack, ++in, userdata);        /* will push the result on the stack */
-      if (in == NULL)
-        return NULL;
+        while (*in != ')') {
+            in = parse(stack, ++in, userdata);        /* will push the result on the stack */
+            if (in == NULL)
+                return NULL;
+        }
+        ++in;
+        foo = find_function(symbol);
+        if (foo == NULL) {
+            log_error("parser does not know about \"%s\" function.\n", symbol);
+            return NULL;
+        }
+        foo(stack, userdata);        /* will pop parameters from stack (reverse order!) and push the result */
     }
-    ++in;
-    foo = find_function(symbol);
-    if (foo == NULL) {
-      log_error("parser does not know about \"%s\" function.\n", symbol);
-      return NULL;
+    else {
+        variable *var = find_variable(symbol);
+        if (braces && *in == '}') {
+            ++in;
+        }
+        /* it's a constant (variable is a misnomer, but heck, const was taken;)) */
+        if (var == NULL) {
+            log_error("parser does not know about \"%s\" variable.\n", symbol);
+            return NULL;
+        }
+        opush(stack, var->value);
     }
-    foo(stack, userdata);        /* will pop parameters from stack (reverse order!) and push the result */
-  } else {
-    variable *var = find_variable(symbol);
-    if (braces && *in == '}') {
-      ++in;
-    }
-    /* it's a constant (variable is a misnomer, but heck, const was taken;)) */
-    if (var == NULL) {
-      log_error("parser does not know about \"%s\" variable.\n", symbol);
-      return NULL;
-    }
-    opush(stack, var->value);
-  }
-  return in;
+    return in;
 }
 
 #define TOKENSIZE 4096
 static const char *parse_string(opstack ** stack, const char *in,
-  const void *userdata)
+    const void *userdata)
 {                               /* (char*) -> char* */
-  char *c;
-  char *buffer = balloc(TOKENSIZE);
-  size_t size = TOKENSIZE - 1;
-  const char *ic = in;
-  char *oc = buffer;
-  /* mode flags */
-  bool f_escape = false;
-  bool bDone = false;
-  variant var;
+    char *c;
+    char *buffer = balloc(TOKENSIZE);
+    size_t size = TOKENSIZE - 1;
+    const char *ic = in;
+    char *oc = buffer;
+    /* mode flags */
+    bool f_escape = false;
+    bool bDone = false;
+    variant var;
 
-  while (*ic && !bDone) {
-    if (f_escape) {
-      f_escape = false;
-      switch (*ic) {
-        case 'n':
-          if (size > 0) {
-            *oc++ = '\n';
-            --size;
-          }
-          break;
-        case 't':
-          if (size > 0) {
-            *oc++ = '\t';
-            --size;
-          }
-          break;
-        default:
-          if (size > 0) {
-            *oc++ = *ic++;
-            --size;
-          }
-      }
-    } else {
-      int ch = (unsigned char)(*ic);
-      int bytes;
+    while (*ic && !bDone) {
+        if (f_escape) {
+            f_escape = false;
+            switch (*ic) {
+            case 'n':
+                if (size > 0) {
+                    *oc++ = '\n';
+                    --size;
+                }
+                break;
+            case 't':
+                if (size > 0) {
+                    *oc++ = '\t';
+                    --size;
+                }
+                break;
+            default:
+                if (size > 0) {
+                    *oc++ = *ic++;
+                    --size;
+                }
+            }
+        }
+        else {
+            int ch = (unsigned char)(*ic);
+            int bytes;
 
-      switch (ch) {
-        case '\\':
-          f_escape = true;
-          ++ic;
-          break;
-        case '"':
-          bDone = true;
-          ++ic;
-          break;
-        case '$':
-          ic = parse_symbol(stack, ++ic, userdata);
-          if (ic == NULL)
-            return NULL;
-          c = (char *)opop_v(stack);
-          bytes = (int)(c?strlcpy(oc, c, size):0);
-          if (bytes < (int)size)
-            oc += bytes;
-          else
-            oc += size;
-          bfree(c);
-          break;
-        default:
-          if (size > 0) {
-            *oc++ = *ic++;
-            --size;
-          } else
-            ++ic;
-      }
+            switch (ch) {
+            case '\\':
+                f_escape = true;
+                ++ic;
+                break;
+            case '"':
+                bDone = true;
+                ++ic;
+                break;
+            case '$':
+                ic = parse_symbol(stack, ++ic, userdata);
+                if (ic == NULL)
+                    return NULL;
+                c = (char *)opop_v(stack);
+                bytes = (int)(c ? strlcpy(oc, c, size) : 0);
+                if (bytes < (int)size)
+                    oc += bytes;
+                else
+                    oc += size;
+                bfree(c);
+                break;
+            default:
+                if (size > 0) {
+                    *oc++ = *ic++;
+                    --size;
+                }
+                else
+                    ++ic;
+            }
+        }
     }
-  }
-  *oc++ = '\0';
-  bfree(oc);
-  var.v = buffer;
-  opush(stack, var);
-  return ic;
+    *oc++ = '\0';
+    bfree(oc);
+    var.v = buffer;
+    opush(stack, var);
+    return ic;
 }
 
 static const char *parse_int(opstack ** stack, const char *in)
 {
-  int k = 0;
-  int vz = 1;
-  bool ok = false;
-  variant var;
-  do {
-    switch (*in) {
-      case '+':
-        ++in;
-        break;
-      case '-':
-        ++in;
-        vz = vz * -1;
-        break;
-      default:
-        ok = true;
+    int k = 0;
+    int vz = 1;
+    bool ok = false;
+    variant var;
+    do {
+        switch (*in) {
+        case '+':
+            ++in;
+            break;
+        case '-':
+            ++in;
+            vz = vz * -1;
+            break;
+        default:
+            ok = true;
+        }
+    } while (!ok);
+    while (isdigit(*(unsigned char *)in)) {
+        k = k * 10 + (*in++) - '0';
     }
-  } while (!ok);
-  while (isdigit(*(unsigned char *)in)) {
-    k = k * 10 + (*in++) - '0';
-  }
-  var.i = k * vz;
-  opush(stack, var);
-  return in;
+    var.i = k * vz;
+    opush(stack, var);
+    return in;
 }
 
 static const char *parse(opstack ** stack, const char *inn,
-  const void *userdata)
+    const void *userdata)
 {
-  const char *b = inn;
-  while (*b) {
-    switch (*b) {
-      case '"':
-        return parse_string(stack, ++b, userdata);
-        break;
-      case '$':
-        return parse_symbol(stack, ++b, userdata);
-        break;
-      default:
-        if (isdigit(*(unsigned char *)b) || *b == '-' || *b == '+') {
-          return parse_int(stack, b);
-        } else
-          ++b;
+    const char *b = inn;
+    while (*b) {
+        switch (*b) {
+        case '"':
+            return parse_string(stack, ++b, userdata);
+            break;
+        case '$':
+            return parse_symbol(stack, ++b, userdata);
+            break;
+        default:
+            if (isdigit(*(unsigned char *)b) || *b == '-' || *b == '+') {
+                return parse_int(stack, b);
+            }
+            else
+                ++b;
+        }
     }
-  }
-  log_error("could not parse \"%s\". Probably invalid message syntax.", inn);
-  return NULL;
+    log_error("could not parse \"%s\". Probably invalid message syntax.", inn);
+    return NULL;
 }
 
 const char *translate(const char *format, const void *userdata,
-  const char *vars, variant args[])
+    const char *vars, variant args[])
 {
-  int i = 0;
-  const char *ic = vars;
-  char symbol[32];
-  char *oc = symbol;
-  opstack *stack = NULL;
-  const char *rv;
+    int i = 0;
+    const char *ic = vars;
+    char symbol[32];
+    char *oc = symbol;
+    opstack *stack = NULL;
+    const char *rv;
 
-  brelease();
-  free_variables();
+    brelease();
+    free_variables();
 
-  assert(format);
-  assert(*ic == 0 || isalnum(*ic));
-  while (*ic) {
-    *oc++ = *ic++;
-    if (!isalnum(*ic)) {
-      variant x = args[i++];
-      *oc = '\0';
-      oc = symbol;
-      add_variable(strcpy(balloc(strlen(symbol) + 1), symbol), x);
-      while (*ic && !isalnum(*ic))
-        ++ic;
+    assert(format);
+    assert(*ic == 0 || isalnum(*ic));
+    while (*ic) {
+        *oc++ = *ic++;
+        if (!isalnum(*ic)) {
+            variant x = args[i++];
+            *oc = '\0';
+            oc = symbol;
+            add_variable(strcpy(balloc(strlen(symbol) + 1), symbol), x);
+            while (*ic && !isalnum(*ic))
+                ++ic;
+        }
     }
-  }
 
-  if (format[0] == '"') {
-    rv = parse(&stack, format, userdata);
-  } else {
-    rv = parse_string(&stack, format, userdata);
-  }
-  if (rv != NULL) {
-    if (rv[0]) {
-      log_error("residual data after parsing: %s\n", rv);
+    if (format[0] == '"') {
+        rv = parse(&stack, format, userdata);
     }
-    rv = (const char *)opop(&stack).v;
-    free(stack->begin);
-    free(stack);
-  }
-  return rv;
+    else {
+        rv = parse_string(&stack, format, userdata);
+    }
+    if (rv != NULL) {
+        if (rv[0]) {
+            log_error("residual data after parsing: %s\n", rv);
+        }
+        rv = (const char *)opop(&stack).v;
+        free(stack->begin);
+        free(stack);
+    }
+    return rv;
 }
 
 static void eval_lt(opstack ** stack, const void *userdata)
 {                               /* (int, int) -> int */
-  int a = opop_i(stack);
-  int b = opop_i(stack);
-  int rval = (b < a) ? 1 : 0;
-  opush_i(stack, rval);
-  unused_arg(userdata);
+    int a = opop_i(stack);
+    int b = opop_i(stack);
+    int rval = (b < a) ? 1 : 0;
+    opush_i(stack, rval);
+    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);
+    int a = opop_i(stack);
+    int b = opop_i(stack);
+    int rval = (a == b) ? 1 : 0;
+    opush_i(stack, rval);
+    unused_arg(userdata);
 }
 
 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);
+    int a = opop_i(stack);
+    int b = opop_i(stack);
+    opush_i(stack, a + b);
+    unused_arg(userdata);
 }
 
 static void eval_isnull(opstack ** stack, const void *userdata)
 {                               /* (int, int) -> int */
-  void *a = opop_v(stack);
-  opush_i(stack, (a == NULL) ? 1 : 0);
-  unused_arg(userdata);
+    void *a = opop_v(stack);
+    opush_i(stack, (a == NULL) ? 1 : 0);
+    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);
+    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_strlen(opstack ** stack, const void *userdata)
 {                               /* string -> int */
-  const char *c = (const char *)opop_v(stack);
-  opush_i(stack, c ? (int)strlen(c) : 0);
-  unused_arg(userdata);
+    const char *c = (const char *)opop_v(stack);
+    opush_i(stack, c ? (int)strlen(c) : 0);
+    unused_arg(userdata);
 }
 
 #include "base36.h"
 static void eval_int(opstack ** stack, const void *userdata)
 {
-  int i = opop_i(stack);
-  const char *c = itoa10(i);
-  size_t len = strlen(c);
-  variant var;
+    int i = opop_i(stack);
+    const char *c = itoa10(i);
+    size_t len = strlen(c);
+    variant var;
 
-  var.v = strcpy(balloc(len + 1), c);
-  opush(stack, var);
+    var.v = strcpy(balloc(len + 1), c);
+    opush(stack, var);
 }
 
 void translation_init(void)
 {
-  add_function("lt", &eval_lt);
-  add_function("eq", &eval_eq);
-  add_function("int", &eval_int);
-  add_function("add", &eval_add);
-  add_function("strlen", &eval_strlen);
-  add_function("if", &eval_if);
-  add_function("isnull", &eval_isnull);
+    add_function("lt", &eval_lt);
+    add_function("eq", &eval_eq);
+    add_function("int", &eval_int);
+    add_function("add", &eval_add);
+    add_function("strlen", &eval_strlen);
+    add_function("if", &eval_if);
+    add_function("isnull", &eval_isnull);
 }
 
 void translation_done(void)
 {
-  free_functions();
-  free(buffer.begin);
+    free_functions();
+    free(buffer.begin);
 }
diff --git a/src/util/translation.h b/src/util/translation.h
index f918c3357..01c19a72d 100644
--- a/src/util/translation.h
+++ b/src/util/translation.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
@@ -6,9 +6,9 @@
  |                   |  Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
  +-------------------+  Stefan Reich <reich@halbling.de>
 
- This program may not be used, modified or distributed 
+ This program may not be used, modified or distributed
  without prior permission by the authors of Eressea.
-*/
+ */
 
 #ifndef H_UTIL_TRANSLATION
 #define H_UTIL_TRANSLATION
@@ -17,28 +17,28 @@ extern "C" {
 #endif
 
 #include "variant.h"
-  struct opstack;
-  extern void opstack_push(struct opstack **stack, variant data);
+    struct opstack;
+    extern void opstack_push(struct opstack **stack, variant data);
 #define opush_i(stack, x) { variant localvar; localvar.i = x; opstack_push(stack, localvar); }
 #define opush_v(stack, x) { variant localvar; localvar.v = x; opstack_push(stack, localvar); }
 #define opush(stack, i) opstack_push(stack, i)
 
-  extern variant opstack_pop(struct opstack **stack);
+    extern variant opstack_pop(struct opstack **stack);
 #define opop_v(stack) opstack_pop(stack).v
 #define opop_i(stack) opstack_pop(stack).i
 #define opop(stack) opstack_pop(stack)
 
-  extern void translation_init(void);
-  extern void translation_done(void);
-  extern const char *translate(const char *format, const void *userdata,
-    const char *vars, variant args[]);
+    extern void translation_init(void);
+    extern void translation_done(void);
+    extern const char *translate(const char *format, const void *userdata,
+        const char *vars, variant args[]);
 
-/* eval_x functions */
-  typedef void (*evalfun) (struct opstack ** stack, const void *);
-  extern void add_function(const char *symbol, evalfun parse);
+    /* eval_x functions */
+    typedef void(*evalfun) (struct opstack ** stack, const void *);
+    extern void add_function(const char *symbol, evalfun parse);
 
-/* transient memory blocks */
-  extern char *balloc(size_t size);
+    /* transient memory blocks */
+    extern char *balloc(size_t size);
 
 #ifdef __cplusplus
 }
diff --git a/src/util/umlaut.c b/src/util/umlaut.c
index c7072987c..5493b688c 100644
--- a/src/util/umlaut.c
+++ b/src/util/umlaut.c
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
 Katja Zedel <katze@felidae.kn-bremen.de
 Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/util/umlaut.h b/src/util/umlaut.h
index a82d4567c..9a86505dd 100644
--- a/src/util/umlaut.h
+++ b/src/util/umlaut.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -30,17 +30,17 @@ extern "C" {
 #define E_TOK_SUCCESS 0
 #define NODEHASHSIZE 8
 
-  int findtoken(const void *tk, const char *str, variant * result);
-  void addtoken(void **root, const char *str, variant id);
-  void freetokens(void *root);
+    int findtoken(const void *tk, const char *str, variant * result);
+    void addtoken(void **root, const char *str, variant id);
+    void freetokens(void *root);
 
-  char * transliterate(char * out, size_t size, const char * in);
+    char * transliterate(char * out, size_t size, const char * in);
 
-  typedef struct local_names {
-    struct local_names *next;
-    const struct locale *lang;
-    void * names;
-  } local_names;
+    typedef struct local_names {
+        struct local_names *next;
+        const struct locale *lang;
+        void * names;
+    } local_names;
 
 #ifdef __cplusplus
 }
diff --git a/src/util/umlaut.test.c b/src/util/umlaut.test.c
index 86b07f08e..e36c9f3c9 100644
--- a/src/util/umlaut.test.c
+++ b/src/util/umlaut.test.c
@@ -6,72 +6,72 @@
 
 static void test_transliterate(CuTest * tc)
 {
-  char buffer[32];
+    char buffer[32];
 
-  CuAssertStrEquals(tc, "", transliterate(buffer, sizeof(buffer), ""));
-  CuAssertStrEquals(tc, "herpderp", transliterate(buffer, sizeof(buffer), "herpderp"));
-  CuAssertStrEquals(tc, "herpderp", buffer);
+    CuAssertStrEquals(tc, "", transliterate(buffer, sizeof(buffer), ""));
+    CuAssertStrEquals(tc, "herpderp", transliterate(buffer, sizeof(buffer), "herpderp"));
+    CuAssertStrEquals(tc, "herpderp", buffer);
 
-  CuAssertStrEquals(tc, "herpderp", transliterate(buffer, sizeof(buffer), "HERPDERP"));
-  CuAssertStrEquals(tc, "haerpdaerp", transliterate(buffer, sizeof(buffer), "h\xc3\xa4rpd\xc3\xa4rp"));
-  CuAssertStrEquals(tc, "aeoeuess", transliterate(buffer, sizeof(buffer), "\xc3\xa4\xc3\xb6\xc3\xbc\xc3\x9f"));
-  CuAssertStrEquals(tc, "aeoeuess", transliterate(buffer, sizeof(buffer), "\xc3\x84\xc3\x96\xc3\x9c\xe1\xba\x9e"));
+    CuAssertStrEquals(tc, "herpderp", transliterate(buffer, sizeof(buffer), "HERPDERP"));
+    CuAssertStrEquals(tc, "haerpdaerp", transliterate(buffer, sizeof(buffer), "h\xc3\xa4rpd\xc3\xa4rp"));
+    CuAssertStrEquals(tc, "aeoeuess", transliterate(buffer, sizeof(buffer), "\xc3\xa4\xc3\xb6\xc3\xbc\xc3\x9f"));
+    CuAssertStrEquals(tc, "aeoeuess", transliterate(buffer, sizeof(buffer), "\xc3\x84\xc3\x96\xc3\x9c\xe1\xba\x9e"));
 
-  /* handle buffer that is too small */
-  CuAssertStrEquals(tc, 0, transliterate(buffer, 1, "herpderp"));
-  CuAssertStrEquals(tc, "", buffer);
-  CuAssertStrEquals(tc, 0, transliterate(buffer, 3, "herpderp"));
-  CuAssertStrEquals(tc, "he", buffer);
-  CuAssertStrEquals(tc, 0, transliterate(buffer, 3, "h\xc3\xa4rpd\xc3\xa4rp"));
-  CuAssertStrEquals(tc, "h?", buffer);
+    /* handle buffer that is too small */
+    CuAssertStrEquals(tc, 0, transliterate(buffer, 1, "herpderp"));
+    CuAssertStrEquals(tc, "", buffer);
+    CuAssertStrEquals(tc, 0, transliterate(buffer, 3, "herpderp"));
+    CuAssertStrEquals(tc, "he", buffer);
+    CuAssertStrEquals(tc, 0, transliterate(buffer, 3, "h\xc3\xa4rpd\xc3\xa4rp"));
+    CuAssertStrEquals(tc, "h?", buffer);
 }
 
 static void test_umlaut(CuTest * tc)
 {
-  const char * umlauts = "\xc3\xa4\xc3\xb6\xc3\xbc\xc3\x9f"; /* auml ouml uuml szlig nul */
-  void * tokens = 0;
-  variant id;
-  int result;
+    const char * umlauts = "\xc3\xa4\xc3\xb6\xc3\xbc\xc3\x9f"; /* auml ouml uuml szlig nul */
+    void * tokens = 0;
+    variant id;
+    int result;
 
-  /* don't crash on an empty set */
-  result = findtoken(tokens, "herpderp", &id);
-  CuAssertIntEquals(tc, E_TOK_NOMATCH, result);
+    /* don't crash on an empty set */
+    result = findtoken(tokens, "herpderp", &id);
+    CuAssertIntEquals(tc, E_TOK_NOMATCH, result);
 
-  id.i = 1;
-  addtoken(&tokens, "herpderp", id);
-  id.i = 2;
-  addtoken(&tokens, "derp", id);
-  id.i = 3;
-  addtoken(&tokens, umlauts, id);
+    id.i = 1;
+    addtoken(&tokens, "herpderp", id);
+    id.i = 2;
+    addtoken(&tokens, "derp", id);
+    id.i = 3;
+    addtoken(&tokens, umlauts, id);
 
-  /* we can find substrings if they are significant */
-  result = findtoken(tokens, "herp", &id);
-  CuAssertIntEquals(tc, E_TOK_SUCCESS, result);
-  CuAssertIntEquals(tc, 1, id.i);
+    /* we can find substrings if they are significant */
+    result = findtoken(tokens, "herp", &id);
+    CuAssertIntEquals(tc, E_TOK_SUCCESS, result);
+    CuAssertIntEquals(tc, 1, id.i);
 
-  result = findtoken(tokens, "DERP", &id);
-  CuAssertIntEquals(tc, E_TOK_SUCCESS, result);
-  CuAssertIntEquals(tc, 2, id.i);
+    result = findtoken(tokens, "DERP", &id);
+    CuAssertIntEquals(tc, E_TOK_SUCCESS, result);
+    CuAssertIntEquals(tc, 2, id.i);
 
-  result = findtoken(tokens, umlauts, &id);
-  CuAssertIntEquals(tc, E_TOK_SUCCESS, result);
-  CuAssertIntEquals(tc, 3, id.i);
+    result = findtoken(tokens, umlauts, &id);
+    CuAssertIntEquals(tc, E_TOK_SUCCESS, result);
+    CuAssertIntEquals(tc, 3, id.i);
 
-  /* transliteration is the real magic */
-  result = findtoken(tokens, "AEoeUEss", &id);
-  CuAssertIntEquals(tc, E_TOK_SUCCESS, result);
-  CuAssertIntEquals(tc, 3, id.i);
+    /* transliteration is the real magic */
+    result = findtoken(tokens, "AEoeUEss", &id);
+    CuAssertIntEquals(tc, E_TOK_SUCCESS, result);
+    CuAssertIntEquals(tc, 3, id.i);
 
-  result = findtoken(tokens, "herp-a-derp", &id);
-  CuAssertIntEquals(tc, E_TOK_NOMATCH, result);
+    result = findtoken(tokens, "herp-a-derp", &id);
+    CuAssertIntEquals(tc, E_TOK_NOMATCH, result);
 
-  freetokens(tokens);
+    freetokens(tokens);
 }
 
 CuSuite *get_umlaut_suite(void)
 {
-  CuSuite *suite = CuSuiteNew();
-  SUITE_ADD_TEST(suite, test_umlaut);
-  SUITE_ADD_TEST(suite, test_transliterate);
-  return suite;
+    CuSuite *suite = CuSuiteNew();
+    SUITE_ADD_TEST(suite, test_umlaut);
+    SUITE_ADD_TEST(suite, test_transliterate);
+    return suite;
 }
diff --git a/src/util/unicode.c b/src/util/unicode.c
index 5f6c715b5..2a369ae1e 100644
--- a/src/util/unicode.c
+++ b/src/util/unicode.c
@@ -1,11 +1,11 @@
-/* vi: set ts=2:
+/* 
  * +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  * |                   |  Enno Rehling <enno@eressea.de>
  * | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
- * | (c) 1998 - 2007   |  
+ * | (c) 1998 - 2007   |
  * |                   |  This program may not be used, modified or distributed
  * +-------------------+  without prior permission by the authors of Eressea.
- *  
+ *
  */
 
 #include <platform.h>
@@ -33,541 +33,562 @@
 
 int unicode_utf8_tolower(utf8_t * op, size_t outlen, const utf8_t * ip)
 {
-  while (*ip) {
-    ucs4_t ucs = *ip;
-    ucs4_t low;
-    size_t size = 1;
+    while (*ip) {
+        ucs4_t ucs = *ip;
+        ucs4_t low;
+        size_t size = 1;
 
-    if (ucs & 0x80) {
-      int ret = unicode_utf8_to_ucs4(&ucs, ip, &size);
-      if (ret != 0) {
-        return ret;
-      }
+        if (ucs & 0x80) {
+            int ret = unicode_utf8_to_ucs4(&ucs, ip, &size);
+            if (ret != 0) {
+                return ret;
+            }
+        }
+        if (size > outlen) {
+            return ENOMEM;
+        }
+        low = towlower((wint_t)ucs);
+        if (low == ucs) {
+            memcpy(op, ip, size);
+            ip += size;
+            op += size;
+            outlen -= size;
+        }
+        else {
+            ip += size;
+            unicode_ucs4_to_utf8(op, &size, low);
+            op += size;
+            outlen -= size;
+        }
     }
-    if (size > outlen) {
-      return ENOMEM;
-    }
-    low = towlower((wint_t) ucs);
-    if (low == ucs) {
-      memcpy(op, ip, size);
-      ip += size;
-      op += size;
-      outlen -= size;
-    } else {
-      ip += size;
-      unicode_ucs4_to_utf8(op, &size, low);
-      op += size;
-      outlen -= size;
-    }
-  }
 
-  if (outlen <= 0) {
-    return ENOMEM;
-  }
-  *op = 0;
-  return 0;
+    if (outlen <= 0) {
+        return ENOMEM;
+    }
+    *op = 0;
+    return 0;
 }
 
 int
 unicode_latin1_to_utf8(utf8_t * dst, size_t * outlen, const char *in,
-  size_t * inlen)
+size_t * inlen)
 {
-  int is = (int)*inlen;
-  int os = (int)*outlen;
-  const char *ip = in;
-  unsigned char *out = (unsigned char *)dst, *op = out;
+    int is = (int)*inlen;
+    int os = (int)*outlen;
+    const char *ip = in;
+    unsigned char *out = (unsigned char *)dst, *op = out;
 
-  while (ip - in < is) {
-    unsigned char c = *ip;
-    if (c > 0xBF) {
-      if (op - out >= os - 1)
-        break;
-      *op++ = 0xC3;
-      *op++ = c - 64;
-    } else if (c > 0x7F) {
-      if (op - out >= os - 1)
-        break;
-      *op++ = 0xC2;
-      *op++ = c;
-    } else {
-      if (op - out >= os)
-        break;
-      *op++ = c;
+    while (ip - in < is) {
+        unsigned char c = *ip;
+        if (c > 0xBF) {
+            if (op - out >= os - 1)
+                break;
+            *op++ = 0xC3;
+            *op++ = c - 64;
+        }
+        else if (c > 0x7F) {
+            if (op - out >= os - 1)
+                break;
+            *op++ = 0xC2;
+            *op++ = c;
+        }
+        else {
+            if (op - out >= os)
+                break;
+            *op++ = c;
+        }
+        ++ip;
     }
-    ++ip;
-  }
-  *outlen = op - out;
-  *inlen = ip - in;
-  return (int)*outlen;
+    *outlen = op - out;
+    *inlen = ip - in;
+    return (int)*outlen;
 }
 
 int unicode_utf8_strcasecmp(const utf8_t * a, const char *b)
 {
-  while (*a && *b) {
-    int ret;
-    size_t size;
-    ucs4_t ucsa = *a, ucsb = *b;
+    while (*a && *b) {
+        int ret;
+        size_t size;
+        ucs4_t ucsa = *a, ucsb = *b;
 
-    if (ucsa & 0x80) {
-      ret = unicode_utf8_to_ucs4(&ucsa, a, &size);
-      if (ret != 0)
-        return -1;
-      a += size;
-    } else
-      ++a;
-    if (ucsb & 0x80) {
-      ret = unicode_utf8_to_ucs4(&ucsb, b, &size);
-      if (ret != 0)
-        return -1;
-      b += size;
-    } else
-      ++b;
+        if (ucsa & 0x80) {
+            ret = unicode_utf8_to_ucs4(&ucsa, a, &size);
+            if (ret != 0)
+                return -1;
+            a += size;
+        }
+        else
+            ++a;
+        if (ucsb & 0x80) {
+            ret = unicode_utf8_to_ucs4(&ucsb, b, &size);
+            if (ret != 0)
+                return -1;
+            b += size;
+        }
+        else
+            ++b;
 
-    if (ucsb != ucsa) {
-      ucsb = towlower((wint_t) ucsb);
-      ucsa = towlower((wint_t) ucsa);
-      if (ucsb < ucsa)
-        return 1;
-      if (ucsb > ucsa)
-        return -1;
+        if (ucsb != ucsa) {
+            ucsb = towlower((wint_t)ucsb);
+            ucsa = towlower((wint_t)ucsa);
+            if (ucsb < ucsa)
+                return 1;
+            if (ucsb > ucsa)
+                return -1;
+        }
     }
-  }
-  if (*b)
-    return -1;
-  if (*a)
-    return 1;
-  return 0;
+    if (*b)
+        return -1;
+    if (*a)
+        return 1;
+    return 0;
 }
 
 /* Convert a UCS-4 character to UTF-8. */
 int
 unicode_ucs4_to_utf8(utf8_t * utf8_character, size_t * size,
-  ucs4_t ucs4_character)
+ucs4_t ucs4_character)
 {
-  int utf8_bytes;
+    int utf8_bytes;
 
-  if (ucs4_character <= 0x0000007F) {
-    /* 0xxxxxxx */
-    utf8_bytes = 1;
-    utf8_character[0] = (char)ucs4_character;
-  } else if (ucs4_character <= 0x000007FF) {
-    /* 110xxxxx 10xxxxxx */
-    utf8_bytes = 2;
-    utf8_character[0] = (char)((ucs4_character >> 6) | B11000000);
-    utf8_character[1] = (char)((ucs4_character & B00111111) | B10000000);
-  } else if (ucs4_character <= 0x0000FFFF) {
-    /* 1110xxxx 10xxxxxx 10xxxxxx */
-    utf8_bytes = 3;
-    utf8_character[0] = (char)((ucs4_character >> 12) | B11100000);
-    utf8_character[1] = (char)(((ucs4_character >> 6) & B00111111) | B10000000);
-    utf8_character[2] = (char)((ucs4_character & B00111111) | B10000000);
-  } else if (ucs4_character <= 0x001FFFFF) {
-    /* 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */
-    utf8_bytes = 4;
-    utf8_character[0] = (char)((ucs4_character >> 18) | B11110000);
-    utf8_character[1] =
-      (char)(((ucs4_character >> 12) & B00111111) | B10000000);
-    utf8_character[2] = (char)(((ucs4_character >> 6) & B00111111) | B10000000);
-    utf8_character[3] = (char)((ucs4_character & B00111111) | B10000000);
-  } else if (ucs4_character <= 0x03FFFFFF) {
-    /* 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */
-    utf8_bytes = 5;
-    utf8_character[0] = (char)((ucs4_character >> 24) | B11111000);
-    utf8_character[1] =
-      (char)(((ucs4_character >> 18) & B00111111) | B10000000);
-    utf8_character[2] =
-      (char)(((ucs4_character >> 12) & B00111111) | B10000000);
-    utf8_character[3] = (char)(((ucs4_character >> 6) & B00111111) | B10000000);
-    utf8_character[4] = (char)((ucs4_character & B00111111) | B10000000);
-  } else if (ucs4_character <= 0x7FFFFFFF) {
-    /* 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */
-    utf8_bytes = 6;
-    utf8_character[0] = (char)((ucs4_character >> 30) | B11111100);
-    utf8_character[1] =
-      (char)(((ucs4_character >> 24) & B00111111) | B10000000);
-    utf8_character[2] =
-      (char)(((ucs4_character >> 18) & B00111111) | B10000000);
-    utf8_character[3] =
-      (char)(((ucs4_character >> 12) & B00111111) | B10000000);
-    utf8_character[4] = (char)(((ucs4_character >> 6) & B00111111) | B10000000);
-    utf8_character[5] = (char)((ucs4_character & B00111111) | B10000000);
-  } else {
-    return EILSEQ;
-  }
+    if (ucs4_character <= 0x0000007F) {
+        /* 0xxxxxxx */
+        utf8_bytes = 1;
+        utf8_character[0] = (char)ucs4_character;
+    }
+    else if (ucs4_character <= 0x000007FF) {
+        /* 110xxxxx 10xxxxxx */
+        utf8_bytes = 2;
+        utf8_character[0] = (char)((ucs4_character >> 6) | B11000000);
+        utf8_character[1] = (char)((ucs4_character & B00111111) | B10000000);
+    }
+    else if (ucs4_character <= 0x0000FFFF) {
+        /* 1110xxxx 10xxxxxx 10xxxxxx */
+        utf8_bytes = 3;
+        utf8_character[0] = (char)((ucs4_character >> 12) | B11100000);
+        utf8_character[1] = (char)(((ucs4_character >> 6) & B00111111) | B10000000);
+        utf8_character[2] = (char)((ucs4_character & B00111111) | B10000000);
+    }
+    else if (ucs4_character <= 0x001FFFFF) {
+        /* 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */
+        utf8_bytes = 4;
+        utf8_character[0] = (char)((ucs4_character >> 18) | B11110000);
+        utf8_character[1] =
+            (char)(((ucs4_character >> 12) & B00111111) | B10000000);
+        utf8_character[2] = (char)(((ucs4_character >> 6) & B00111111) | B10000000);
+        utf8_character[3] = (char)((ucs4_character & B00111111) | B10000000);
+    }
+    else if (ucs4_character <= 0x03FFFFFF) {
+        /* 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */
+        utf8_bytes = 5;
+        utf8_character[0] = (char)((ucs4_character >> 24) | B11111000);
+        utf8_character[1] =
+            (char)(((ucs4_character >> 18) & B00111111) | B10000000);
+        utf8_character[2] =
+            (char)(((ucs4_character >> 12) & B00111111) | B10000000);
+        utf8_character[3] = (char)(((ucs4_character >> 6) & B00111111) | B10000000);
+        utf8_character[4] = (char)((ucs4_character & B00111111) | B10000000);
+    }
+    else if (ucs4_character <= 0x7FFFFFFF) {
+        /* 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */
+        utf8_bytes = 6;
+        utf8_character[0] = (char)((ucs4_character >> 30) | B11111100);
+        utf8_character[1] =
+            (char)(((ucs4_character >> 24) & B00111111) | B10000000);
+        utf8_character[2] =
+            (char)(((ucs4_character >> 18) & B00111111) | B10000000);
+        utf8_character[3] =
+            (char)(((ucs4_character >> 12) & B00111111) | B10000000);
+        utf8_character[4] = (char)(((ucs4_character >> 6) & B00111111) | B10000000);
+        utf8_character[5] = (char)((ucs4_character & B00111111) | B10000000);
+    }
+    else {
+        return EILSEQ;
+    }
 
-  *size = utf8_bytes;
+    *size = utf8_bytes;
 
-  return 0;
+    return 0;
 }
 
 /* Convert a UTF-8 encoded character to UCS-4. */
 int
 unicode_utf8_to_ucs4(ucs4_t * ucs4_character, const utf8_t * utf8_string,
-  size_t * length)
+size_t * length)
 {
-  utf8_t utf8_character = utf8_string[0];
+    utf8_t utf8_character = utf8_string[0];
 
-  /* Is the character in the ASCII range? If so, just copy it to the
-     output. */
-  if (~utf8_character & 0x80) {
-    *ucs4_character = utf8_character;
-    *length = 1;
-  } else if ((utf8_character & 0xE0) == 0xC0) {
-    /* A two-byte UTF-8 sequence. Make sure the other byte is good. */
-    if (utf8_string[1] != '\0' && (utf8_string[1] & 0xC0) != 0x80) {
-      return EILSEQ;
+    /* Is the character in the ASCII range? If so, just copy it to the
+       output. */
+    if (~utf8_character & 0x80) {
+        *ucs4_character = utf8_character;
+        *length = 1;
+    }
+    else if ((utf8_character & 0xE0) == 0xC0) {
+        /* A two-byte UTF-8 sequence. Make sure the other byte is good. */
+        if (utf8_string[1] != '\0' && (utf8_string[1] & 0xC0) != 0x80) {
+            return EILSEQ;
+        }
+
+        *ucs4_character =
+            ((utf8_string[1] & 0x3F) << 0) + ((utf8_character & 0x1F) << 6);
+        *length = 2;
+    }
+    else if ((utf8_character & 0xF0) == 0xE0) {
+        /* A three-byte UTF-8 sequence. Make sure the other bytes are
+           good. */
+        if ((utf8_string[1] != '\0') &&
+            (utf8_string[1] & 0xC0) != 0x80 &&
+            (utf8_string[2] != '\0') && (utf8_string[2] & 0xC0) != 0x80) {
+            return EILSEQ;
+        }
+
+        *ucs4_character =
+            ((utf8_string[2] & 0x3F) << 0) +
+            ((utf8_string[1] & 0x3F) << 6) + ((utf8_character & 0x0F) << 12);
+        *length = 3;
+    }
+    else if ((utf8_character & 0xF8) == 0xF0) {
+        /* A four-byte UTF-8 sequence. Make sure the other bytes are
+           good. */
+        if ((utf8_string[1] != '\0') &&
+            (utf8_string[1] & 0xC0) != 0x80 &&
+            (utf8_string[2] != '\0') &&
+            (utf8_string[2] & 0xC0) != 0x80 &&
+            (utf8_string[3] != '\0') && (utf8_string[3] & 0xC0) != 0x80) {
+            return EILSEQ;
+        }
+
+        *ucs4_character =
+            ((utf8_string[3] & 0x3F) << 0) +
+            ((utf8_string[2] & 0x3F) << 6) +
+            ((utf8_string[1] & 0x3F) << 12) + ((utf8_character & 0x07) << 18);
+        *length = 4;
+    }
+    else if ((utf8_character & 0xFC) == 0xF8) {
+        /* A five-byte UTF-8 sequence. Make sure the other bytes are
+           good. */
+        if ((utf8_string[1] != '\0') &&
+            (utf8_string[1] & 0xC0) != 0x80 &&
+            (utf8_string[2] != '\0') &&
+            (utf8_string[2] & 0xC0) != 0x80 &&
+            (utf8_string[3] != '\0') &&
+            (utf8_string[3] & 0xC0) != 0x80 &&
+            (utf8_string[4] != '\0') && (utf8_string[4] & 0xC0) != 0x80) {
+            return EILSEQ;
+        }
+
+        *ucs4_character =
+            ((utf8_string[4] & 0x3F) << 0) +
+            ((utf8_string[3] & 0x3F) << 6) +
+            ((utf8_string[2] & 0x3F) << 12) +
+            ((utf8_string[1] & 0x3F) << 18) + ((utf8_character & 0x03) << 24);
+        *length = 5;
+    }
+    else if ((utf8_character & 0xFE) == 0xFC) {
+        /* A six-byte UTF-8 sequence. Make sure the other bytes are
+           good. */
+        if ((utf8_string[1] != '\0') &&
+            (utf8_string[1] & 0xC0) != 0x80 &&
+            (utf8_string[2] != '\0') &&
+            (utf8_string[2] & 0xC0) != 0x80 &&
+            (utf8_string[3] != '\0') &&
+            (utf8_string[3] & 0xC0) != 0x80 &&
+            (utf8_string[4] != '\0') &&
+            (utf8_string[4] & 0xC0) != 0x80 &&
+            (utf8_string[5] != '\0') && (utf8_string[5] & 0xC0) != 0x80) {
+            return EILSEQ;
+        }
+
+        *ucs4_character =
+            ((utf8_string[5] & 0x3F) << 0) +
+            ((utf8_string[4] & 0x3F) << 6) +
+            ((utf8_string[3] & 0x3F) << 12) +
+            ((utf8_string[2] & 0x3F) << 18) +
+            ((utf8_string[1] & 0x3F) << 24) + ((utf8_character & 0x01) << 30);
+        *length = 6;
+    }
+    else {
+        return EILSEQ;
     }
 
-    *ucs4_character =
-      ((utf8_string[1] & 0x3F) << 0) + ((utf8_character & 0x1F) << 6);
-    *length = 2;
-  } else if ((utf8_character & 0xF0) == 0xE0) {
-    /* A three-byte UTF-8 sequence. Make sure the other bytes are
-       good. */
-    if ((utf8_string[1] != '\0') &&
-      (utf8_string[1] & 0xC0) != 0x80 &&
-      (utf8_string[2] != '\0') && (utf8_string[2] & 0xC0) != 0x80) {
-      return EILSEQ;
-    }
-
-    *ucs4_character =
-      ((utf8_string[2] & 0x3F) << 0) +
-      ((utf8_string[1] & 0x3F) << 6) + ((utf8_character & 0x0F) << 12);
-    *length = 3;
-  } else if ((utf8_character & 0xF8) == 0xF0) {
-    /* A four-byte UTF-8 sequence. Make sure the other bytes are
-       good. */
-    if ((utf8_string[1] != '\0') &&
-      (utf8_string[1] & 0xC0) != 0x80 &&
-      (utf8_string[2] != '\0') &&
-      (utf8_string[2] & 0xC0) != 0x80 &&
-      (utf8_string[3] != '\0') && (utf8_string[3] & 0xC0) != 0x80) {
-      return EILSEQ;
-    }
-
-    *ucs4_character =
-      ((utf8_string[3] & 0x3F) << 0) +
-      ((utf8_string[2] & 0x3F) << 6) +
-      ((utf8_string[1] & 0x3F) << 12) + ((utf8_character & 0x07) << 18);
-    *length = 4;
-  } else if ((utf8_character & 0xFC) == 0xF8) {
-    /* A five-byte UTF-8 sequence. Make sure the other bytes are
-       good. */
-    if ((utf8_string[1] != '\0') &&
-      (utf8_string[1] & 0xC0) != 0x80 &&
-      (utf8_string[2] != '\0') &&
-      (utf8_string[2] & 0xC0) != 0x80 &&
-      (utf8_string[3] != '\0') &&
-      (utf8_string[3] & 0xC0) != 0x80 &&
-      (utf8_string[4] != '\0') && (utf8_string[4] & 0xC0) != 0x80) {
-      return EILSEQ;
-    }
-
-    *ucs4_character =
-      ((utf8_string[4] & 0x3F) << 0) +
-      ((utf8_string[3] & 0x3F) << 6) +
-      ((utf8_string[2] & 0x3F) << 12) +
-      ((utf8_string[1] & 0x3F) << 18) + ((utf8_character & 0x03) << 24);
-    *length = 5;
-  } else if ((utf8_character & 0xFE) == 0xFC) {
-    /* A six-byte UTF-8 sequence. Make sure the other bytes are
-       good. */
-    if ((utf8_string[1] != '\0') &&
-      (utf8_string[1] & 0xC0) != 0x80 &&
-      (utf8_string[2] != '\0') &&
-      (utf8_string[2] & 0xC0) != 0x80 &&
-      (utf8_string[3] != '\0') &&
-      (utf8_string[3] & 0xC0) != 0x80 &&
-      (utf8_string[4] != '\0') &&
-      (utf8_string[4] & 0xC0) != 0x80 &&
-      (utf8_string[5] != '\0') && (utf8_string[5] & 0xC0) != 0x80) {
-      return EILSEQ;
-    }
-
-    *ucs4_character =
-      ((utf8_string[5] & 0x3F) << 0) +
-      ((utf8_string[4] & 0x3F) << 6) +
-      ((utf8_string[3] & 0x3F) << 12) +
-      ((utf8_string[2] & 0x3F) << 18) +
-      ((utf8_string[1] & 0x3F) << 24) + ((utf8_character & 0x01) << 30);
-    *length = 6;
-  } else {
-    return EILSEQ;
-  }
-
-  return 0;
+    return 0;
 }
 
 /** Convert a UTF-8 encoded character to CP437. */
 int
 unicode_utf8_to_cp437(char *cp_character, const utf8_t * utf8_string,
-  size_t * length)
+size_t * length)
 {
-  ucs4_t ucs4_character;
-  int result;
+    ucs4_t ucs4_character;
+    int result;
 
-  result = unicode_utf8_to_ucs4(&ucs4_character, utf8_string, length);
-  if (result != 0) {
-    /* pass decoding characters upstream */
-    return result;
-  }
+    result = unicode_utf8_to_ucs4(&ucs4_character, utf8_string, length);
+    if (result != 0) {
+        /* pass decoding characters upstream */
+        return result;
+    }
 
-  if (ucs4_character < 0x7F) {
-    *cp_character = (char)ucs4_character;
-  } else {
-    struct {
-      ucs4_t ucs4;
-      unsigned char cp437;
-    } xref[160] = {
-      {
-      0x00A0, 255}, {
-      0x00A1, 173}, {
-      0x00A2, 155}, {
-      0x00A3, 156}, {
-      0x00A5, 157}, {
-      0x00A7, 21}, {
-      0x00AA, 166}, {
-      0x00AB, 174}, {
-      0x00AC, 170}, {
-      0x00B0, 248}, {
-      0x00B1, 241}, {
-      0x00B2, 253}, {
-      0x00B5, 230}, {
-      0x00B6, 20}, {
-      0x00B7, 250}, {
-      0x00BA, 167}, {
-      0x00BB, 175}, {
-      0x00BC, 172}, {
-      0x00BD, 171}, {
-      0x00BF, 168}, {
-      0x00C4, 142}, {
-      0x00C5, 143}, {
-      0x00C6, 146}, {
-      0x00C7, 128}, {
-      0x00C9, 144}, {
-      0x00D1, 165}, {
-      0x00D6, 153}, {
-      0x00DC, 154}, {
-      0x00DF, 225}, {
-      0x00E0, 133}, {
-      0x00E1, 160}, {
-      0x00E2, 131}, {
-      0x00E4, 132}, {
-      0x00E5, 134}, {
-      0x00E6, 145}, {
-      0x00E7, 135}, {
-      0x00E8, 138}, {
-      0x00E9, 130}, {
-      0x00EA, 136}, {
-      0x00EB, 137}, {
-      0x00EC, 141}, {
-      0x00ED, 161}, {
-      0x00EE, 140}, {
-      0x00EF, 139}, {
-      0x00F1, 164}, {
-      0x00F2, 149}, {
-      0x00F3, 162}, {
-      0x00F4, 147}, {
-      0x00F6, 148}, {
-      0x00F7, 246}, {
-      0x00F9, 151}, {
-      0x00FA, 163}, {
-      0x00FB, 150}, {
-      0x00FC, 129}, {
-      0x00FF, 152}, {
-      0x0192, 159}, {
-      0x0393, 226}, {
-      0x0398, 233}, {
-      0x03A3, 228}, {
-      0x03A6, 232}, {
-      0x03A9, 234}, {
-      0x03B1, 224}, {
-      0x03B4, 235}, {
-      0x03B5, 238}, {
-      0x03C0, 227}, {
-      0x03C3, 229}, {
-      0x03C4, 231}, {
-      0x03C6, 237}, {
-      0x2022, 7}, {
-      0x203C, 19}, {
-      0x207F, 252}, {
-      0x20A7, 158}, {
-      0x2190, 27}, {
-      0x2191, 24}, {
-      0x2192, 26}, {
-      0x2193, 25}, {
-      0x2194, 29}, {
-      0x2195, 18}, {
-      0x21A8, 23}, {
-      0x2219, 249}, {
-      0x221A, 251}, {
-      0x221E, 236}, {
-      0x221F, 28}, {
-      0x2229, 239}, {
-      0x2248, 247}, {
-      0x2261, 240}, {
-      0x2264, 243}, {
-      0x2265, 242}, {
-      0x2302, 127}, {
-      0x2310, 169}, {
-      0x2320, 244}, {
-      0x2321, 245}, {
-      0x2500, 196}, {
-      0x2502, 179}, {
-      0x250C, 218}, {
-      0x2510, 191}, {
-      0x2514, 192}, {
-      0x2518, 217}, {
-      0x251C, 195}, {
-      0x2524, 180}, {
-      0x252C, 194}, {
-      0x2534, 193}, {
-      0x253C, 197}, {
-      0x2550, 205}, {
-      0x2551, 186}, {
-      0x2552, 213}, {
-      0x2553, 214}, {
-      0x2554, 201}, {
-      0x2555, 184}, {
-      0x2556, 183}, {
-      0x2557, 187}, {
-      0x2558, 212}, {
-      0x2559, 211}, {
-      0x255A, 200}, {
-      0x255B, 190}, {
-      0x255C, 189}, {
-      0x255D, 188}, {
-      0x255E, 198}, {
-      0x255F, 199}, {
-      0x2560, 204}, {
-      0x2561, 181}, {
-      0x2562, 182}, {
-      0x2563, 185}, {
-      0x2564, 209}, {
-      0x2565, 210}, {
-      0x2566, 203}, {
-      0x2567, 207}, {
-      0x2568, 208}, {
-      0x2569, 202}, {
-      0x256A, 216}, {
-      0x256B, 215}, {
-      0x256C, 206}, {
-      0x2580, 223}, {
-      0x2584, 220}, {
-      0x2588, 219}, {
-      0x258C, 221}, {
-      0x2590, 222}, {
-      0x2591, 176}, {
-      0x2592, 177}, {
-      0x2593, 178}, {
-      0x25A0, 254}, {
-      0x25AC, 22}, {
-      0x25B2, 30}, {
-      0x25BA, 16}, {
-      0x25BC, 31}, {
-      0x25C4, 17}, {
-      0x25CB, 9}, {
-      0x25D8, 8}, {
-      0x25D9, 10}, {
-      0x263A, 1}, {
-      0x263B, 2}, {
-      0x263C, 15}, {
-      0x2640, 12}, {
-      0x2642, 11}, {
-      0x2660, 6}, {
-      0x2663, 5}, {
-      0x2665, 3}, {
-      0x2666, 4}, {
-      0x266A, 13}, {
-      0x266B, 14}
-    };
-    int l = 0, r = 160;
-    while (l != r) {
-      int m = (l + r) / 2;
-      if (xref[m].ucs4 == ucs4_character) {
-        *cp_character = (char)xref[m].cp437;
-        break;
-      } else if (xref[m].ucs4 < ucs4_character)
-        l = m;
-      else
-        r = m;
+    if (ucs4_character < 0x7F) {
+        *cp_character = (char)ucs4_character;
     }
-    if (l == r) {
-      *cp_character = '?';
+    else {
+        struct {
+            ucs4_t ucs4;
+            unsigned char cp437;
+        } xref[160] = {
+            {
+                0x00A0, 255 }, {
+                    0x00A1, 173 }, {
+                        0x00A2, 155 }, {
+                            0x00A3, 156 }, {
+                                0x00A5, 157 }, {
+                                    0x00A7, 21 }, {
+                                        0x00AA, 166 }, {
+                                            0x00AB, 174 }, {
+                                                0x00AC, 170 }, {
+                                                    0x00B0, 248 }, {
+                                                        0x00B1, 241 }, {
+                                                            0x00B2, 253 }, {
+                                                                0x00B5, 230 }, {
+                                                                    0x00B6, 20 }, {
+                                                                        0x00B7, 250 }, {
+                                                                            0x00BA, 167 }, {
+                                                                                0x00BB, 175 }, {
+                                                                                    0x00BC, 172 }, {
+                                                                                        0x00BD, 171 }, {
+                                                                                            0x00BF, 168 }, {
+                                                                                                0x00C4, 142 }, {
+                                                                                                    0x00C5, 143 }, {
+                                                                                                        0x00C6, 146 }, {
+                                                                                                            0x00C7, 128 }, {
+                                                                                                                0x00C9, 144 }, {
+                                                                                                                    0x00D1, 165 }, {
+                                                                                                                        0x00D6, 153 }, {
+                                                                                                                            0x00DC, 154 }, {
+                                                                                                                                0x00DF, 225 }, {
+                                                                                                                                    0x00E0, 133 }, {
+                                                                                                                                        0x00E1, 160 }, {
+                                                                                                                                            0x00E2, 131 }, {
+                                                                                                                                                0x00E4, 132 }, {
+                                                                                                                                                    0x00E5, 134 }, {
+                                                                                                                                                        0x00E6, 145 }, {
+                                                                                                                                                            0x00E7, 135 }, {
+                                                                                                                                                                0x00E8, 138 }, {
+                                                                                                                                                                    0x00E9, 130 }, {
+                                                                                                                                                                        0x00EA, 136 }, {
+                                                                                                                                                                            0x00EB, 137 }, {
+                                                                                                                                                                                0x00EC, 141 }, {
+                                                                                                                                                                                    0x00ED, 161 }, {
+                                                                                                                                                                                        0x00EE, 140 }, {
+                                                                                                                                                                                            0x00EF, 139 }, {
+                                                                                                                                                                                                0x00F1, 164 }, {
+                                                                                                                                                                                                    0x00F2, 149 }, {
+                                                                                                                                                                                                        0x00F3, 162 }, {
+                                                                                                                                                                                                            0x00F4, 147 }, {
+                                                                                                                                                                                                                0x00F6, 148 }, {
+                                                                                                                                                                                                                    0x00F7, 246 }, {
+                                                                                                                                                                                                                        0x00F9, 151 }, {
+                                                                                                                                                                                                                            0x00FA, 163 }, {
+                                                                                                                                                                                                                                0x00FB, 150 }, {
+                                                                                                                                                                                                                                    0x00FC, 129 }, {
+                                                                                                                                                                                                                                        0x00FF, 152 }, {
+                                                                                                                                                                                                                                            0x0192, 159 }, {
+                                                                                                                                                                                                                                                0x0393, 226 }, {
+                                                                                                                                                                                                                                                    0x0398, 233 }, {
+                                                                                                                                                                                                                                                        0x03A3, 228 }, {
+                                                                                                                                                                                                                                                            0x03A6, 232 }, {
+                                                                                                                                                                                                                                                                0x03A9, 234 }, {
+                                                                                                                                                                                                                                                                    0x03B1, 224 }, {
+                                                                                                                                                                                                                                                                        0x03B4, 235 }, {
+                                                                                                                                                                                                                                                                            0x03B5, 238 }, {
+                                                                                                                                                                                                                                                                                0x03C0, 227 }, {
+                                                                                                                                                                                                                                                                                    0x03C3, 229 }, {
+                                                                                                                                                                                                                                                                                        0x03C4, 231 }, {
+                                                                                                                                                                                                                                                                                            0x03C6, 237 }, {
+                                                                                                                                                                                                                                                                                                0x2022, 7 }, {
+                                                                                                                                                                                                                                                                                                    0x203C, 19 }, {
+                                                                                                                                                                                                                                                                                                        0x207F, 252 }, {
+                                                                                                                                                                                                                                                                                                            0x20A7, 158 }, {
+                                                                                                                                                                                                                                                                                                                0x2190, 27 }, {
+                                                                                                                                                                                                                                                                                                                    0x2191, 24 }, {
+                                                                                                                                                                                                                                                                                                                        0x2192, 26 }, {
+                                                                                                                                                                                                                                                                                                                            0x2193, 25 }, {
+                                                                                                                                                                                                                                                                                                                                0x2194, 29 }, {
+                                                                                                                                                                                                                                                                                                                                    0x2195, 18 }, {
+                                                                                                                                                                                                                                                                                                                                        0x21A8, 23 }, {
+                                                                                                                                                                                                                                                                                                                                            0x2219, 249 }, {
+                                                                                                                                                                                                                                                                                                                                                0x221A, 251 }, {
+                                                                                                                                                                                                                                                                                                                                                    0x221E, 236 }, {
+                                                                                                                                                                                                                                                                                                                                                        0x221F, 28 }, {
+                                                                                                                                                                                                                                                                                                                                                            0x2229, 239 }, {
+                                                                                                                                                                                                                                                                                                                                                                0x2248, 247 }, {
+                                                                                                                                                                                                                                                                                                                                                                    0x2261, 240 }, {
+                                                                                                                                                                                                                                                                                                                                                                        0x2264, 243 }, {
+                                                                                                                                                                                                                                                                                                                                                                            0x2265, 242 }, {
+                                                                                                                                                                                                                                                                                                                                                                                0x2302, 127 }, {
+                                                                                                                                                                                                                                                                                                                                                                                    0x2310, 169 }, {
+                                                                                                                                                                                                                                                                                                                                                                                        0x2320, 244 }, {
+                                                                                                                                                                                                                                                                                                                                                                                            0x2321, 245 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                0x2500, 196 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                    0x2502, 179 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                        0x250C, 218 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                            0x2510, 191 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                0x2514, 192 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                    0x2518, 217 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                        0x251C, 195 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                            0x2524, 180 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                0x252C, 194 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                    0x2534, 193 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                        0x253C, 197 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                            0x2550, 205 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                0x2551, 186 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                    0x2552, 213 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                        0x2553, 214 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                            0x2554, 201 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                0x2555, 184 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                    0x2556, 183 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                        0x2557, 187 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                            0x2558, 212 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                0x2559, 211 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    0x255A, 200 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        0x255B, 190 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            0x255C, 189 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                0x255D, 188 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    0x255E, 198 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        0x255F, 199 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            0x2560, 204 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                0x2561, 181 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    0x2562, 182 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        0x2563, 185 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            0x2564, 209 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                0x2565, 210 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    0x2566, 203 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        0x2567, 207 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            0x2568, 208 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                0x2569, 202 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    0x256A, 216 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        0x256B, 215 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            0x256C, 206 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                0x2580, 223 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    0x2584, 220 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        0x2588, 219 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            0x258C, 221 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                0x2590, 222 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    0x2591, 176 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        0x2592, 177 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            0x2593, 178 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                0x25A0, 254 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    0x25AC, 22 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        0x25B2, 30 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            0x25BA, 16 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                0x25BC, 31 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    0x25C4, 17 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        0x25CB, 9 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            0x25D8, 8 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                0x25D9, 10 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    0x263A, 1 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        0x263B, 2 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            0x263C, 15 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                0x2640, 12 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    0x2642, 11 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        0x2660, 6 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            0x2663, 5 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                0x2665, 3 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    0x2666, 4 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        0x266A, 13 }, {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            0x266B, 14 }
+        };
+        int l = 0, r = 160;
+        while (l != r) {
+            int m = (l + r) / 2;
+            if (xref[m].ucs4 == ucs4_character) {
+                *cp_character = (char)xref[m].cp437;
+                break;
+            }
+            else if (xref[m].ucs4 < ucs4_character)
+                l = m;
+            else
+                r = m;
+        }
+        if (l == r) {
+            *cp_character = '?';
+        }
     }
-  }
-  return 0;
+    return 0;
 }
 
 /** Convert a UTF-8 encoded character to CP1252. */
 int
 unicode_utf8_to_cp1252(char *cp_character, const utf8_t * utf8_string,
-  size_t * length)
+size_t * length)
 {
-  ucs4_t ucs4_character;
-  int result;
+    ucs4_t ucs4_character;
+    int result;
 
-  result = unicode_utf8_to_ucs4(&ucs4_character, utf8_string, length);
-  if (result != 0) {
-    /* pass decoding characters upstream */
-    return result;
-  }
+    result = unicode_utf8_to_ucs4(&ucs4_character, utf8_string, length);
+    if (result != 0) {
+        /* pass decoding characters upstream */
+        return result;
+    }
 
-  if (ucs4_character <= 0x7F || ucs4_character >= 0xA0) {
-    *cp_character = (char)ucs4_character;
-  } else {
-    struct {
-      ucs4_t ucs4;
-      unsigned char cp;
-    } xref[] = {
-      {
-      0x20ac, 0x80}, {
-      0x0081, 0x81}, {
-      0x201a, 0x82}, {
-      0x0192, 0x83}, {
-      0x201e, 0x84}, {
-      0x2026, 0x85}, {
-      0x2020, 0x86}, {
-      0x2021, 0x87}, {
-      0x02c6, 0x88}, {
-      0x2030, 0x89}, {
-      0x0160, 0x8a}, {
-      0x2039, 0x8b}, {
-      0x0152, 0x8c}, {
-      0x008d, 0x8d}, {
-      0x017d, 0x8e}, {
-      0x008f, 0x8f}, {
-      0x0090, 0x90}, {
-      0x2018, 0x91}, {
-      0x2019, 0x92}, {
-      0x201c, 0x93}, {
-      0x201d, 0x94}, {
-      0x2022, 0x95}, {
-      0x2013, 0x96}, {
-      0x2014, 0x97}, {
-      0x02dc, 0x98}, {
-      0x2122, 0x99}, {
-      0x0161, 0x9a}, {
-      0x203a, 0x9b}, {
-      0x0153, 0x9c}, {
-      0x009d, 0x9d}, {
-      0x017e, 0x9e}, {
-      0x0178, 0x9f}
-    };
-    int l = 0, r = sizeof(xref) / sizeof(xref[0]);
-    while (l != r) {
-      int m = (l + r) / 2;
-      if (xref[m].ucs4 == ucs4_character) {
-        *cp_character = (char)xref[m].cp;
-        break;
-      } else if (xref[m].ucs4 < ucs4_character)
-        l = m;
-      else
-        r = m;
+    if (ucs4_character <= 0x7F || ucs4_character >= 0xA0) {
+        *cp_character = (char)ucs4_character;
     }
-    if (l == r) {
-      *cp_character = '?';
+    else {
+        struct {
+            ucs4_t ucs4;
+            unsigned char cp;
+        } xref[] = {
+            {
+                0x20ac, 0x80 }, {
+                    0x0081, 0x81 }, {
+                        0x201a, 0x82 }, {
+                            0x0192, 0x83 }, {
+                                0x201e, 0x84 }, {
+                                    0x2026, 0x85 }, {
+                                        0x2020, 0x86 }, {
+                                            0x2021, 0x87 }, {
+                                                0x02c6, 0x88 }, {
+                                                    0x2030, 0x89 }, {
+                                                        0x0160, 0x8a }, {
+                                                            0x2039, 0x8b }, {
+                                                                0x0152, 0x8c }, {
+                                                                    0x008d, 0x8d }, {
+                                                                        0x017d, 0x8e }, {
+                                                                            0x008f, 0x8f }, {
+                                                                                0x0090, 0x90 }, {
+                                                                                    0x2018, 0x91 }, {
+                                                                                        0x2019, 0x92 }, {
+                                                                                            0x201c, 0x93 }, {
+                                                                                                0x201d, 0x94 }, {
+                                                                                                    0x2022, 0x95 }, {
+                                                                                                        0x2013, 0x96 }, {
+                                                                                                            0x2014, 0x97 }, {
+                                                                                                                0x02dc, 0x98 }, {
+                                                                                                                    0x2122, 0x99 }, {
+                                                                                                                        0x0161, 0x9a }, {
+                                                                                                                            0x203a, 0x9b }, {
+                                                                                                                                0x0153, 0x9c }, {
+                                                                                                                                    0x009d, 0x9d }, {
+                                                                                                                                        0x017e, 0x9e }, {
+                                                                                                                                            0x0178, 0x9f }
+        };
+        int l = 0, r = sizeof(xref) / sizeof(xref[0]);
+        while (l != r) {
+            int m = (l + r) / 2;
+            if (xref[m].ucs4 == ucs4_character) {
+                *cp_character = (char)xref[m].cp;
+                break;
+            }
+            else if (xref[m].ucs4 < ucs4_character)
+                l = m;
+            else
+                r = m;
+        }
+        if (l == r) {
+            *cp_character = '?';
+        }
     }
-  }
-  return 0;
+    return 0;
 }
diff --git a/src/util/unicode.h b/src/util/unicode.h
index ad0dbd3ae..1edf98571 100644
--- a/src/util/unicode.h
+++ b/src/util/unicode.h
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
-                         Katja Zedel <katze@felidae.kn-bremen.de
-                         Christian Schlittchen <corwin@amber.kn-bremen.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
+Katja Zedel <katze@felidae.kn-bremen.de
+Christian Schlittchen <corwin@amber.kn-bremen.de>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
@@ -25,22 +25,22 @@ extern "C" {
 
 #include <wchar.h>
 #define USE_UNICODE
-  typedef unsigned long ucs4_t;
-  typedef char utf8_t;
+    typedef unsigned long ucs4_t;
+    typedef char utf8_t;
 
-  extern int unicode_utf8_to_cp437(char *result, const utf8_t * utf8_string,
-    size_t * length);
-  extern int unicode_utf8_to_cp1252(char *result, const utf8_t * utf8_string,
-    size_t * length);
-  extern int unicode_utf8_to_ucs4(ucs4_t * result, const utf8_t * utf8_string,
-    size_t * length);
-  extern int unicode_ucs4_to_utf8(utf8_t * result, size_t * size,
-    ucs4_t ucs4_character);
-  extern int unicode_utf8_strcasecmp(const utf8_t * a, const utf8_t * b);
-  extern int unicode_latin1_to_utf8(utf8_t * out, size_t * outlen,
-    const char *in, size_t * inlen);
-  extern int unicode_utf8_tolower(utf8_t * out, size_t outlen,
-    const utf8_t * in);
+    extern int unicode_utf8_to_cp437(char *result, const utf8_t * utf8_string,
+        size_t * length);
+    extern int unicode_utf8_to_cp1252(char *result, const utf8_t * utf8_string,
+        size_t * length);
+    extern int unicode_utf8_to_ucs4(ucs4_t * result, const utf8_t * utf8_string,
+        size_t * length);
+    extern int unicode_ucs4_to_utf8(utf8_t * result, size_t * size,
+        ucs4_t ucs4_character);
+    extern int unicode_utf8_strcasecmp(const utf8_t * a, const utf8_t * b);
+    extern int unicode_latin1_to_utf8(utf8_t * out, size_t * outlen,
+        const char *in, size_t * inlen);
+    extern int unicode_utf8_tolower(utf8_t * out, size_t outlen,
+        const utf8_t * in);
 
 #ifdef __cplusplus
 }
diff --git a/src/util/xml.c b/src/util/xml.c
index 7150641fd..741165027 100644
--- a/src/util/xml.c
+++ b/src/util/xml.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
diff --git a/src/util/xml.h b/src/util/xml.h
index 9ffe4406e..b2235b521 100644
--- a/src/util/xml.h
+++ b/src/util/xml.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  |                   |  Enno Rehling <enno@eressea.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
diff --git a/src/vortex.c b/src/vortex.c
index 79b37fb8a..ab391f012 100644
--- a/src/vortex.c
+++ b/src/vortex.c
@@ -78,7 +78,7 @@ static int a_readdirection(attrib * a, void *owner, struct storage *store)
     spec_direction *d = (spec_direction *)(a->data.v);
     char lbuf[32];
 
-    (void) owner;
+    (void)owner;
     READ_INT(store, &d->x);
     READ_INT(store, &d->y);
     READ_INT(store, &d->duration);
diff --git a/src/wormhole.c b/src/wormhole.c
index fa1836fad..421201790 100644
--- a/src/wormhole.c
+++ b/src/wormhole.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  +-------------------+
  |                   |  Christian Schlittchen <corwin@amber.kn-bremen.de>
  | Eressea PBEM host |  Enno Rehling <enno@eressea.de>
diff --git a/src/wormhole.h b/src/wormhole.h
index 68e1a11b1..f91e3f001 100644
--- a/src/wormhole.h
+++ b/src/wormhole.h
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
+Copyright (c) 1998-2015, Enno Rehling Rehling <enno@eressea.de>
                          Katja Zedel <katze@felidae.kn-bremen.de
                          Christian Schlittchen <corwin@amber.kn-bremen.de>
 
diff --git a/src/xmlreport.c b/src/xmlreport.c
index 19b9ff53f..43d7cc55b 100644
--- a/src/xmlreport.c
+++ b/src/xmlreport.c
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
 +-------------------+  Enno Rehling <enno@eressea.de>
 | Eressea PBEM host |  Christian Schlittchen <corwin@amber.kn-bremen.de>
 | (c) 1998 - 2008   |  Katja Zedel <katze@felidae.kn-bremen.de>
diff --git a/src/xmlreport.h b/src/xmlreport.h
index bb84fb8dd..676fbd1a2 100644
--- a/src/xmlreport.h
+++ b/src/xmlreport.h
@@ -1,4 +1,4 @@
-/* vi: set ts=2:
+/* 
  +-------------------+  Christian Schlittchen <corwin@amber.kn-bremen.de>
  | Eressea PBEM host |  Katja Zedel <katze@felidae.kn-bremen.de>
  | (c) 1998 - 2005   |  Enno Rehling <enno@eressea.de>