fix indentation in every file

fix copyright date
remove vi ts=2 code
remove a couple of superfluous extern declarations
This commit is contained in:
Enno Rehling 2015-01-30 20:37:14 +01:00
parent 45ebe35681
commit abca25d1d5
346 changed files with 19574 additions and 19283 deletions

View file

@ -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>
@ -82,7 +82,8 @@ void herbsearch(region * r, unit * u, int max)
i_change(&u->items, whichherb, herbsfound);
ADDMSG(&u->faction->msgs, msg_message("herbfound",
"unit region amount herb", u, r, herbsfound, whichherb->rtype));
} else {
}
else {
ADDMSG(&u->faction->msgs, msg_message("researchherb_none",
"unit region", u, u->region));
}
@ -135,7 +136,8 @@ static int do_potion(unit * u, region *r, const potion_type * ptype, int amount)
if (fval(r, RF_MALLORN)) {
holz = use_pooled(u, rt_find("mallorn"),
GET_SLACK | GET_RESERVE | GET_POOLED_SLACK, tree_count * amount);
} else {
}
else {
holz = use_pooled(u, rt_find("log"),
GET_SLACK | GET_RESERVE | GET_POOLED_SLACK, tree_count * amount);
}
@ -151,25 +153,31 @@ static int do_potion(unit * u, region *r, const potion_type * ptype, int 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]) {
}
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]) {
}
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]) {
}
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]) {
}
else if (ptype == oldpotiontype[P_WAHRHEIT]) {
fset(u, UFL_DISBELIEVES);
amount = 1;
} else if (ptype == oldpotiontype[P_MACHT]) {
}
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 {
}
else {
change_effect(u, ptype, 10 * amount);
}
return amount;
@ -181,7 +189,8 @@ int use_potion(unit * u, const item_type * itype, int amount, struct order *ord)
if (oldpotiontype[P_HEAL] && ptype == oldpotiontype[P_HEAL]) {
return EUNUSABLE;
} else {
}
else {
int result = begin_potion(u, ptype, ord);
if (result)
return result;
@ -322,7 +331,8 @@ int change_effect(unit * u, const potion_type * effect, int delta)
if (data->value + delta == 0) {
a_remove(&u->attribs, a);
return 0;
} else {
}
else {
data->value += delta;
return data->value;
}

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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
}

View file

@ -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>

View file

@ -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>
@ -24,8 +24,8 @@ extern "C" {
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
}

View file

@ -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>

View file

@ -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>
@ -26,7 +26,7 @@ extern "C" {
struct unit;
extern struct attrib *make_follow(struct unit *u);
struct attrib *make_follow(struct unit *u);
#ifdef __cplusplus
}

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>
@ -27,7 +27,7 @@ extern "C" {
extern struct attrib_type at_iceberg;
extern struct attrib *make_iceberg(direction_t dir);
struct attrib *make_iceberg(direction_t dir);
#ifdef __cplusplus
}

View file

@ -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>

View file

@ -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>
@ -24,9 +24,9 @@ extern "C" {
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
}

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>
@ -45,9 +45,11 @@ void set_racename(attrib ** palist, const char *name)
if (!a && name) {
a = a_add(palist, a_new(&at_racename));
a->data.v = _strdup(name);
} else if (a && !name) {
}
else if (a && !name) {
a_remove(palist, a);
} else if (a) {
}
else if (a) {
if (strcmp(a->data.v, name) != 0) {
free(a->data.v);
a->data.v = _strdup(name);

View file

@ -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>

View file

@ -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>
@ -37,7 +37,8 @@ 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 {
}
else {
free(a->data.v);
}
assert(a->type == &at_raceprefix);

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -1,4 +1,4 @@
/* vi: set ts=2:
/*
+-------------------+
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
@ -34,7 +34,8 @@ int tolua_buildinglist_next(lua_State * L)
tolua_pushusertype(L, (void *)u, TOLUA_CAST "building");
*building_ptr = u->next;
return 1;
} else
}
else
return 0; /* no more values to return */
}

View file

@ -1,4 +1,4 @@
/* vi: set ts=2:
/*
+-------------------+
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>

View file

@ -34,7 +34,8 @@ int config_parse(const char *json)
cJSON_Delete(conf);
init_locales();
return 0;
} else {
}
else {
int line;
char buffer[10];
const char *xp = json, *lp, *ep = cJSON_GetErrorPtr();

View file

@ -1,4 +1,4 @@
/* vi: set ts=2:
/*
+-------------------+
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>

View file

@ -1,4 +1,4 @@
/* vi: set ts=2:
/*
+-------------------+
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>

View file

@ -1,4 +1,4 @@
/* vi: set ts=2:
/*
+-------------------+
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
@ -43,7 +43,8 @@ int tolua_factionlist_next(lua_State * L)
tolua_pushusertype(L, (void *)f, TOLUA_CAST "faction");
*faction_ptr = f->next;
return 1;
} else
}
else
return 0; /* no more values to return */
}
@ -114,7 +115,8 @@ static int tolua_faction_set_id(lua_State * L)
if (findfaction(id) == NULL) {
renumber_faction(self, id);
lua_pushboolean(L, 1);
} else {
}
else {
lua_pushboolean(L, 0);
}
return 1;
@ -259,7 +261,8 @@ static int tolua_faction_set_policy(lua_State * L)
if (value) {
set_alliance(self, other, get_alliance(self,
other) | helpmodes[mode].status);
} else {
}
else {
set_alliance(self, other, get_alliance(self,
other) & ~helpmodes[mode].status);
}
@ -309,7 +312,8 @@ static int tolua_faction_get_origin(lua_State * L)
if (origin) {
x = origin->x;
y = origin->y;
} else {
}
else {
x = 0;
y = 0;
}

View file

@ -1,4 +1,4 @@
/* vi: set ts=2:
/*
+-------------------+
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>

View file

@ -96,7 +96,8 @@ void tag_rewind(tag_iterator * iter)
if (!iter->r) {
tag_advance(iter);
}
} else {
}
else {
iter->node = 0;
iter->hash = MAXTHASH;
}
@ -109,7 +110,8 @@ static int tolua_tags_next(lua_State * L)
tolua_pushusertype(L, (void *)iter->r, TOLUA_CAST "region");
tag_advance(iter);
return 1;
} else {
}
else {
return 0; /* no more values to return */
}
}
@ -171,7 +173,8 @@ static void lua_paint_info(struct window *wnd, const struct state *st)
log_error("paint function failed: %s\n", error);
lua_pop(L, 1);
tolua_error(L, TOLUA_CAST "event handler call failed", NULL);
} else {
}
else {
const char *result = lua_tostring(L, -1);
WINDOW *win = wnd->handle;
int size = getmaxx(win) - 2;
@ -203,7 +206,8 @@ static int tolua_set_display(lua_State * L)
paint_state = L;
set_info_function(&lua_paint_info);
} else {
}
else {
set_info_function(NULL);
}
return 0;

View file

@ -85,7 +85,8 @@ int msg_set_resource(lua_message * msg, const char *param, const char *resname)
rtype = rt_find(resname);
if (rtype) {
msg->args[i].v = (void *)rtype;
} else {
}
else {
return E_INVALID_PARAMETER_VALUE;
}
return E_OK;
@ -260,9 +261,11 @@ 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)) {
}
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)) {
}
else if (tolua_isusertype(L, 3, TOLUA_CAST "unit", 0, &err)) {
return tolua_msg_set_unit(L);
}
tolua_pushnumber(L, (lua_Number)-1);

View file

@ -1,4 +1,4 @@
/* vi: set ts=2:
/*
+-------------------+
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>

View file

@ -39,7 +39,8 @@ static void process_cmd(keyword_t kwd, int (*callback)(unit *, order *), int fla
if (kwd == getkeyword(u->thisorder)) {
callback(u, u->thisorder);
}
} else {
}
else {
order * ord;
for (ord = u->orders; ord; ord = ord->next) {
if (kwd == getkeyword(ord)) {

View file

@ -1,4 +1,4 @@
/* vi: set ts=2:
/*
+-------------------+
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
@ -53,7 +53,8 @@ int tolua_regionlist_next(lua_State * L)
tolua_pushusertype(L, (void *)r, TOLUA_CAST "region");
*region_ptr = r->next;
return 1;
} else
}
else
return 0; /* no more values to return */
}
@ -159,7 +160,8 @@ static int tolua_region_set_terrainname(lua_State * L)
const char *name = tolua_tostring(L, 2, 0);
if (name == NULL) {
a_removeall(&self->attribs, &at_racename);
} else {
}
else {
set_racename(&self->attribs, name);
}
return 0;
@ -375,11 +377,13 @@ static int tolua_region_get_resource(lua_State * L)
result = get_chaoscount(r);
break;
}
} else {
}
else {
rtype = rt_find(type);
if (rtype) {
result = region_getresource(r, rtype);
} else {
}
else {
result = -1;
}
}
@ -411,7 +415,8 @@ static int tolua_region_set_resource(lua_State * L)
add_chaoscount(r, value - get_chaoscount(r));
break;
}
} else {
}
else {
const resource_type *rtype = rt_find(type);
if (rtype != NULL) {
region_setresource(r, rtype, value);
@ -453,7 +458,8 @@ static int tolua_region_create(lua_State * L)
if (terrain == NULL && r != NULL && r->units != NULL) {
/* TODO: error message */
result = NULL;
} else if (r == NULL) {
}
else if (r == NULL) {
result = new_region(x, y, pl, 0);
}
if (result) {
@ -545,7 +551,8 @@ static int tolua_region_setkey(lua_State * L)
attrib *a = find_key(self->attribs, flag);
if (a == NULL && value) {
add_key(&self->attribs, flag);
} else if (a != NULL && !value) {
}
else if (a != NULL && !value) {
a_remove(&self->attribs, a);
}
return 0;

View file

@ -1,4 +1,4 @@
/* vi: set ts=2:
/*
+-------------------+
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>

View file

@ -1,4 +1,4 @@
/* vi: set ts=2:
/*
+-------------------+
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
@ -36,7 +36,8 @@ int tolua_shiplist_next(lua_State * L)
tolua_pushusertype(L, (void *)u, TOLUA_CAST "ship");
*ship_ptr = u->next;
return 1;
} else
}
else
return 0; /* no more values to return */
}
@ -131,7 +132,8 @@ static int tolua_ship_create(lua_State * L)
sh->size = stype->construction ? stype->construction->maxsize : 1;
tolua_pushusertype(L, (void *)sh, TOLUA_CAST "ship");
return 1;
} else {
}
else {
log_error("Unknown ship type '%s'\n", sname);
}
}
@ -165,7 +167,8 @@ 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)) {
}
else if (lua_isnumber(L, 2)) {
self->coast = (direction_t)tolua_tonumber(L, 2, 0);
}
return 0;

View file

@ -1,4 +1,4 @@
/* vi: set ts=2:
/*
+-------------------+
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>

View file

@ -1,4 +1,4 @@
/* vi: set ts=2:
/*
+-------------------+
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>

View file

@ -1,4 +1,4 @@
/* vi: set ts=2:
/*
+-------------------+
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>

View file

@ -1,4 +1,4 @@
/* vi: set ts=2:
/*
+-------------------+
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>

View file

@ -1,4 +1,4 @@
/* vi: set ts=2:
/*
+-------------------+
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
@ -88,7 +88,8 @@ int tolua_unitlist_nextf(lua_State * L)
tolua_pushusertype(L, (void *)u, TOLUA_CAST "unit");
*unit_ptr = u->nextF;
return 1;
} else
}
else
return 0; /* no more values to return */
}
@ -106,7 +107,8 @@ int tolua_unitlist_nextb(lua_State * L)
*unit_ptr = unext;
return 1;
} else
}
else
return 0; /* no more values to return */
}
@ -124,7 +126,8 @@ int tolua_unitlist_nexts(lua_State * L)
*unit_ptr = unext;
return 1;
} else
}
else
return 0; /* no more values to return */
}
@ -136,7 +139,8 @@ int tolua_unitlist_next(lua_State * L)
tolua_pushusertype(L, (void *)u, TOLUA_CAST "unit");
*unit_ptr = u->next;
return 1;
} else
}
else
return 0; /* no more values to return */
}
@ -236,7 +240,8 @@ static int tolua_unit_set_number(lua_State * L)
if (self->number == 0) {
set_number(self, number);
self->hp = unit_max_hp(self) * number;
} else {
}
else {
scale_number(self, number);
}
return 0;
@ -396,7 +401,8 @@ static int tolua_unit_getskill(lua_State * L)
skill *sv = unit_skill(self, sk);
if (sv) {
value = sv->level;
} else
}
else
value = 0;
}
lua_pushinteger(L, value);
@ -505,7 +511,8 @@ static void unit_castspell(unit * u, const char *name, int level)
if (spellbook_get(book, sp)) {
if (!sp->cast) {
log_error("spell '%s' has no function.\n", sp->sname);
} else {
}
else {
castorder co;
create_castorder(&co, u, 0, sp, u->region, level, level * MagicPower(), 0, 0, 0);
sp->cast(&co);
@ -536,7 +543,8 @@ static int tolua_unit_addspell(lua_State * L)
if (!sp) {
log_error("spell %s could not be found\n", str);
return EINVAL;
} else {
}
else {
unit_add_spell(u, 0, sp, level);
}
@ -572,7 +580,8 @@ static int tolua_unit_setskill(lua_State * L)
skill_t sk = findskill(skname);
if (sk != NOSKILL) {
set_level(self, sk, level);
} else {
}
else {
level = -1;
}
lua_pushinteger(L, level);
@ -800,7 +809,8 @@ static int tolua_unit_set_flag(lua_State * L)
attrib *a = find_key(self->attribs, flag);
if (a == NULL && value) {
add_key(&self->attribs, flag);
} else if (a != NULL && !value) {
}
else if (a != NULL && !value) {
a_remove(&self->attribs, a);
}
return 0;
@ -909,11 +919,14 @@ static int tolua_event_get(lua_State * L)
if (arg->type) {
if (strcmp(arg->type, "string") == 0) {
tolua_pushstring(L, (const char *)arg->data.v);
} else if (strcmp(arg->type, "int") == 0) {
}
else if (strcmp(arg->type, "int") == 0) {
lua_pushinteger(L, arg->data.i);
} else if (strcmp(arg->type, "float") == 0) {
}
else if (strcmp(arg->type, "float") == 0) {
lua_pushnumber(L, (lua_Number)arg->data.f);
} else {
}
else {
/* this is pretty lazy */
tolua_pushusertype(L, (void *)arg->data.v, TOLUA_CAST arg->type);
}

View file

@ -1,4 +1,4 @@
/* vi: set ts=2:
/*
+-------------------+
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>

View file

@ -1,4 +1,4 @@
/* vi: set ts=2:
/*
+-------------------+
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
@ -141,7 +141,8 @@ int tolua_quicklist_push(struct lua_State *L, const char *list_type,
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 {
}
else {
lua_pushnil(L);
}
return 1;
@ -208,7 +209,8 @@ static int tolua_setkey(lua_State * L)
attrib *a = find_key(global.attribs, flag);
if (a == NULL && value) {
add_key(&global.attribs, flag);
} else if (a != NULL && !value) {
}
else if (a != NULL && !value) {
a_remove(&global.attribs, a);
}
return 0;
@ -339,15 +341,18 @@ static int tolua_create_curse(lua_State * L)
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)) {
}
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)) {
}
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)) {
}
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;
@ -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);
}

View file

@ -1,4 +1,4 @@
/* vi: set ts=2:
/*
+-------------------+
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>

View file

@ -1,4 +1,4 @@
/* vi: set ts=2:
/*
+-------------------+
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
@ -56,11 +56,13 @@ static int lc_age(struct attrib *a)
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 {
}
else {
result = (int)lua_tonumber(L, -1);
lua_pop(L, 1);
}
} else {
}
else {
log_error("lc_age(%s) calling '%s': not a function.\n", buildingname(b), fname);
lua_pop(L, 1);
}

View file

@ -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>

View file

@ -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>

View file

@ -50,7 +50,8 @@ static int lua_readline(lua_State * l, char *b, const char *prompt)
{
if (my_readline) {
return my_readline(l, b, LUA_MAXINPUT, prompt);
} else {
}
else {
return default_readline(l, b, prompt);
}
}

View file

@ -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>

View file

@ -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>

View file

@ -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>
@ -15,12 +15,10 @@
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
}

View file

@ -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>
@ -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);

View file

@ -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>

View file

@ -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>

View file

@ -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>
@ -141,7 +141,8 @@ static window *win_create(WINDOW * hwin)
wnd->next = wnd_first;
wnd_first->prev = wnd;
wnd_first = wnd;
} else {
}
else {
wnd_first = wnd;
wnd_last = wnd;
}
@ -211,7 +212,8 @@ static chtype mr_tile(const map_region * mr, int highlight)
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 */
}
else if (r->terrain->_name[1] == 'i') { /* firewall */
return '%' | COLOR_PAIR(hl + COLOR_RED) | A_BOLD;
}
break;
@ -224,7 +226,8 @@ static chtype mr_tile(const map_region * mr, int highlight)
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 */
}
else if (r->terrain->_name[1] == 'a') { /* packice */
return ':' | COLOR_PAIR(hl + COLOR_WHITE) | A_BOLD;
}
break;
@ -314,13 +317,15 @@ draw_cursor(WINDOW * win, selection * s, const view * v, const coordinate * c,
if (mr->r->flags & RF_MAPPER_HIGHLIGHT)
hl = 1;
mvwaddch(win, yp, xp, mr_tile(mr, hl) | attr);
} else
}
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 {
}
else {
attr = A_NORMAL;
mvwaddch(win, yp, xp - 1, ' ' | attr | COLOR_PAIR(COLOR_WHITE));
mvwaddch(win, yp, xp + 1, ' ' | attr | COLOR_PAIR(COLOR_WHITE));
@ -340,7 +345,8 @@ static void paint_status(window * wnd, const state * st)
uid = mr->r->uid;
if (mr->r->land) {
name = (const char *)mr->r->land->name;
} else {
}
else {
name = mr->r->terrain->_name;
}
terrain = mr->r->terrain->_name;
@ -370,7 +376,8 @@ static void paint_info_region(window * wnd, const state * st)
const region *r = mr->r;
if (r->land) {
mvwaddnstr(win, line++, 1, (char *)r->land->name, size);
} else {
}
else {
mvwaddnstr(win, line++, 1, r->terrain->_name, size);
}
line++;
@ -610,13 +617,15 @@ static void select_regions(state * st, int selectmode)
free(t);
}
}
} else {
}
else {
region *r;
for (r = regions; r; r = r->next) {
r->flags &= ~RF_MAPPER_HIGHLIGHT;
}
}
} else if (findmode == 'm') {
}
else if (findmode == 'm') {
region *r;
sprintf(sbuffer, "%smonsters", status);
statusline(st->wnd_status->handle, sbuffer);
@ -630,12 +639,14 @@ static void select_regions(state * st, int selectmode)
if (selectmode & MODE_SELECT) {
select_coordinate(st->selected, r->x, r->y,
selectmode == MODE_SELECT);
} else {
}
else {
highlight_region(r, selectmode == MODE_MARK);
}
}
}
} else if (findmode == 'p') {
}
else if (findmode == 'p') {
region *r;
sprintf(sbuffer, "%splayers", status);
statusline(st->wnd_status->handle, sbuffer);
@ -649,12 +660,14 @@ static void select_regions(state * st, int selectmode)
if (selectmode & MODE_SELECT) {
select_coordinate(st->selected, r->x, r->y,
selectmode == MODE_SELECT);
} else {
}
else {
highlight_region(r, selectmode == MODE_MARK);
}
}
}
} else if (findmode == 'u') {
}
else if (findmode == 'u') {
region *r;
sprintf(sbuffer, "%sunits", status);
statusline(st->wnd_status->handle, sbuffer);
@ -663,12 +676,14 @@ static void select_regions(state * st, int selectmode)
if (selectmode & MODE_SELECT) {
select_coordinate(st->selected, r->x, r->y,
selectmode == MODE_SELECT);
} else {
}
else {
highlight_region(r, selectmode == MODE_MARK);
}
}
}
} else if (findmode == 's') {
}
else if (findmode == 's') {
region *r;
sprintf(sbuffer, "%sships", status);
statusline(st->wnd_status->handle, sbuffer);
@ -677,12 +692,14 @@ static void select_regions(state * st, int selectmode)
if (selectmode & MODE_SELECT) {
select_coordinate(st->selected, r->x, r->y,
selectmode == MODE_SELECT);
} else {
}
else {
highlight_region(r, selectmode == MODE_MARK);
}
}
}
} else if (findmode == 'f') {
}
else if (findmode == 'f') {
char fbuffer[12];
sprintf(sbuffer, "%sfaction:", status);
askstring(st->wnd_status->handle, sbuffer, fbuffer, 12);
@ -699,17 +716,20 @@ static void select_regions(state * st, int selectmode)
if (selectmode & MODE_SELECT) {
select_coordinate(st->selected, r->x, r->y,
selectmode == MODE_SELECT);
} else {
}
else {
highlight_region(r, selectmode == MODE_MARK);
}
}
} else {
}
else {
statusline(st->wnd_status->handle, "faction not found.");
beep();
return;
}
}
} else if (findmode == 't') {
}
else if (findmode == 't') {
const struct terrain_type *terrain;
sprintf(sbuffer, "%sterrain: ", status);
statusline(st->wnd_status->handle, sbuffer);
@ -723,13 +743,15 @@ static void select_regions(state * st, int selectmode)
if (selectmode & MODE_SELECT) {
select_coordinate(st->selected, r->x, r->y,
selectmode == MODE_SELECT);
} else {
}
else {
highlight_region(r, selectmode == MODE_MARK);
}
}
}
}
} else {
}
else {
statusline(st->wnd_status->handle, "unknown command.");
beep();
return;
@ -860,10 +882,12 @@ static void handlekey(state * st, int c)
}
if (pl && pl->next) {
cursor->pl = pl->next;
} else {
}
else {
cursor->pl = get_homeplane();
}
} else {
}
else {
cursor->pl = planes;
}
}
@ -877,14 +901,17 @@ static void handlekey(state * st, int c)
plane *pl = rplane(cur);
if (pl == NULL) {
cur = r_standard_to_astral(cur);
} else if (is_astral(cur)) {
}
else if (is_astral(cur)) {
cur = r_astral_to_standard(cur);
} else {
}
else {
cur = NULL;
}
if (cur != NULL) {
region2coord(cur, &st->cursor);
} else {
}
else {
beep();
}
}
@ -1017,20 +1044,25 @@ static void handlekey(state * st, int c)
if (findmode == 'r') {
askstring(st->wnd_status->handle, "find-region:", locate,
sizeof(locate));
} else if (findmode == 'u') {
}
else if (findmode == 'u') {
askstring(st->wnd_status->handle, "find-unit:", locate, sizeof(locate));
} else if (findmode == 'f') {
}
else if (findmode == 'f') {
askstring(st->wnd_status->handle, "find-faction:", locate,
sizeof(locate));
} else if (findmode == 'F') {
}
else if (findmode == 'F') {
faction *f = select_faction(st);
if (f != NULL) {
strcpy(locate, itoa36(f->no));
findmode = 'f';
} else {
}
else {
break;
}
} else {
}
else {
statusline(st->wnd_status->handle, "unknown command.");
beep();
break;
@ -1042,7 +1074,8 @@ static void handlekey(state * st, int c)
if (findmode == 'u') {
unit *u = findunit(atoi36(locate));
r = u ? u->region : NULL;
} else if (findmode && regions != 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;
@ -1061,7 +1094,8 @@ static void handlekey(state * st, int c)
if (findmode == 'r' && r->land && r->land->name
&& strstr((const char *)r->land->name, locate)) {
break;
} else if (findmode == 'f') {
}
else if (findmode == 'f') {
unit *u;
for (u = r->units; u; u = u->next) {
if (u->faction == f) {
@ -1081,7 +1115,8 @@ static void handlekey(state * st, int c)
break;
}
}
} else {
}
else {
r = NULL;
}
if (r != NULL) {
@ -1223,7 +1258,8 @@ void run_mapper(void)
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) {
}
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;
}
@ -1231,7 +1267,8 @@ void run_mapper(void)
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) {
}
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;

View file

@ -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>

View file

@ -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>

View file

@ -1,4 +1,4 @@
/* vi: set ts=2:
/*
+-------------------+
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
@ -64,11 +64,13 @@ lua_giveitem(unit * s, unit * d, const item_type * itype, int n, struct order *o
const char *error = lua_tostring(L, -1);
log_error("unit %s calling '%s': %s.\n", unitname(s), fname, error);
lua_pop(L, 1);
} else {
}
else {
result = (int)lua_tonumber(L, -1);
lua_pop(L, 1);
}
} else {
}
else {
log_error("unit %s trying to call '%s' : not a function.\n", unitname(s), fname);
lua_pop(L, 1);
}
@ -93,11 +95,13 @@ static int limit_resource(const region * r, const resource_type * rtype)
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 {
}
else {
result = (int)lua_tonumber(L, -1);
lua_pop(L, 1);
}
} else {
}
else {
log_error("limit(%s) calling '%s': not a function.\n", regionname(r, NULL), fname);
lua_pop(L, 1);
}
@ -124,7 +128,8 @@ produce_resource(region * r, const resource_type * rtype, int norders)
log_error("produce(%s) calling '%s': %s.\n", regionname(r, NULL), fname, error);
lua_pop(L, 1);
}
} else {
}
else {
log_error("produce(%s) calling '%s': not a function.\n", regionname(r, NULL), fname);
lua_pop(L, 1);
}
@ -184,7 +189,8 @@ static int lua_callspell(castorder * co)
char c = *synp;
if (c == '+') {
push_param(L, *(synp - 1), param);
} else {
}
else {
push_param(L, c, param);
++synp;
}
@ -196,11 +202,13 @@ static int lua_callspell(castorder * co)
const char *error = lua_tostring(L, -1);
log_error("spell(%s) calling '%s': %s.\n", unitname(caster), fname, error);
lua_pop(L, 1);
} else {
}
else {
result = (int)lua_tonumber(L, -1);
lua_pop(L, 1);
}
} else {
}
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);
@ -227,11 +235,13 @@ static int lua_initfamiliar(unit * u)
const char *error = lua_tostring(L, -1);
log_error("familiar(%s) calling '%s': %s.\n", unitname(u), fname, error);
lua_pop(L, 1);
} else {
}
else {
result = (int)lua_tonumber(L, -1);
lua_pop(L, 1);
}
} else {
}
else {
log_warning("familiar(%s) calling '%s': not a function.\n", unitname(u), fname);
lua_pop(L, 1);
}
@ -263,11 +273,13 @@ lua_changeresource(unit * u, const struct resource_type *rtype, int delta)
const char *error = lua_tostring(L, -1);
log_error("change(%s) calling '%s': %s.\n", unitname(u), fname, error);
lua_pop(L, 1);
} else {
}
else {
result = (int)lua_tonumber(L, -1);
lua_pop(L, 1);
}
} else {
}
else {
log_error("change(%s) calling '%s': not a function.\n", unitname(u), fname);
lua_pop(L, 1);
}
@ -292,11 +304,13 @@ static int lua_getresource(unit * u, const struct resource_type *rtype)
const char *error = lua_tostring(L, -1);
log_error("get(%s) calling '%s': %s.\n", unitname(u), fname, error);
lua_pop(L, 1);
} else {
}
else {
result = (int)lua_tonumber(L, -1);
lua_pop(L, 1);
}
} else {
}
else {
log_error("get(%s) calling '%s': not a function.\n", unitname(u), fname);
lua_pop(L, 1);
}
@ -322,11 +336,13 @@ static bool lua_canuse_item(const unit * u, const struct item_type *itype)
const char *error = lua_tostring(L, -1);
log_error("get(%s) calling '%s': %s.\n", unitname(u), fname, error);
lua_pop(L, 1);
} else {
}
else {
result = lua_toboolean(L, -1);
lua_pop(L, 1);
}
} else {
}
else {
function_exists = 0;
log_error("get(%s) calling '%s': not a function.\n", unitname(u), fname);
lua_pop(L, 1);
@ -353,11 +369,13 @@ lua_wage(const region * r, const faction * f, const race * rc, int in_turn)
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 {
}
else {
result = (int)lua_tonumber(L, -1);
lua_pop(L, 1);
}
} else {
}
else {
log_error("wage(%s) calling '%s': not a function.\n", regionname(r, NULL), fname);
lua_pop(L, 1);
}
@ -382,7 +400,8 @@ static void lua_agebuilding(building * b)
log_error("agebuilding(%s) calling '%s': %s.\n", buildingname(b), fname, error);
lua_pop(L, 1);
}
} else {
}
else {
log_error("agebuilding(%s) calling '%s': not a function.\n", buildingname(b), fname);
lua_pop(L, 1);
}
@ -403,11 +422,13 @@ static double lua_building_taxes(building * b, int level)
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 {
}
else {
result = (double)lua_tonumber(L, -1);
lua_pop(L, 1);
}
} else {
}
else {
log_error("building_taxes(%s) calling '%s': not a function.\n", buildingname(b), fname);
lua_pop(L, 1);
}
@ -428,11 +449,13 @@ static int lua_maintenance(const unit * u)
const char *error = lua_tostring(L, -1);
log_error("maintenance(%s) calling '%s': %s.\n", unitname(u), fname, error);
lua_pop(L, 1);
} else {
}
else {
result = (int)lua_tonumber(L, -1);
lua_pop(L, 1);
}
} else {
}
else {
log_error("maintenance(%s) calling '%s': not a function.\n", unitname(u), fname);
lua_pop(L, 1);
}
@ -457,11 +480,13 @@ static int lua_equipmentcallback(const struct equipment *eq, unit * u)
const char *error = lua_tostring(L, -1);
log_error("equip(%s) calling '%s': %s.\n", unitname(u), fname, error);
lua_pop(L, 1);
} else {
}
else {
result = (int)lua_tonumber(L, -1);
lua_pop(L, 1);
}
} else {
}
else {
log_error("equip(%s) calling '%s': not a function.\n", unitname(u), fname);
lua_pop(L, 1);
}
@ -489,11 +514,13 @@ lua_useitem(struct unit *u, const struct item_type *itype, int amount,
const char *error = lua_tostring(L, -1);
log_error("use(%s) calling '%s': %s.\n", unitname(u), fname, error);
lua_pop(L, 1);
} else {
}
else {
result = (int)lua_tonumber(L, -1);
lua_pop(L, 1);
}
} else {
}
else {
log_error("use(%s) calling '%s': not a function.\n", unitname(u), fname);
lua_pop(L, 1);
}
@ -507,7 +534,8 @@ int tolua_toid(lua_State * L, int idx, int def)
int type = lua_type(L, idx);
if (type == LUA_TNUMBER) {
no = (int)tolua_tonumber(L, idx, def);
} else {
}
else {
const char *str = tolua_tostring(L, idx, NULL);
no = str ? atoi36(str) : def;
}

View file

@ -1,4 +1,4 @@
/* vi: set ts=2:
/*
+-------------------+
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>

View file

@ -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>

View file

@ -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>
@ -80,7 +80,8 @@ use_hornofdancing(struct unit *u, const struct item_type *itype,
"unit region", u, u->region));
regionsPacified++;
} else {
}
else {
ADDMSG(&r->msgs, msg_message("hornofpeace_r_nosuccess",
"unit region", u, u->region));
}
@ -90,7 +91,8 @@ use_hornofdancing(struct unit *u, const struct item_type *itype,
if (regionsPacified > 0) {
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "hornofpeace_u_success",
"pacified", regionsPacified));
} else {
}
else {
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "hornofpeace_u_nosuccess",
""));
}

View file

@ -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>

View file

@ -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>
@ -44,7 +44,8 @@ summon_igjarjuk(struct unit *u, const struct item_type *itype, int amount,
if (p != NULL) {
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "use_realworld_only", ""));
return EUNUSABLE;
} else {
}
else {
assert(!"not implemented");
return EUNUSABLE;
}

View file

@ -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>
@ -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
}

View file

@ -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>

View file

@ -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>

View file

@ -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>
@ -66,13 +66,15 @@ use_phoenixcompass(struct unit *u, const struct item_type *itype,
closest_phoenix = u2;
closest_phoenix_distance =
distance(u->region, closest_phoenix->region);
} else {
}
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) {
}
else if (dist == closest_phoenix_distance) {
confusion = true;
}
}
@ -104,7 +106,8 @@ use_phoenixcompass(struct unit *u, const struct item_type *itype,
if (dist < closest_neighbour_distance) {
closest_neighbour_direction = direction;
closest_neighbour_distance = dist;
} else if (dist == closest_neighbour_distance && rng_int() % 100 < 50) {
}
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).

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>
@ -47,7 +47,8 @@ use_speedsail(struct unit *u, const struct item_type *itype, int amount,
unused_arg(itype);
if (p != NULL) {
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "use_realworld_only", ""));
} else {
}
else {
if (u->ship) {
attrib *a = a_find(u->ship->attribs, &at_speedup);
if (a == NULL) {
@ -58,10 +59,12 @@ use_speedsail(struct unit *u, const struct item_type *itype, int amount,
/* Ticket abziehen */
i_change(&u->items, itype, -1);
return 0;
} else {
}
else {
cmistake(u, ord, 211, MSG_EVENT);
}
} else {
}
else {
cmistake(u, ord, 144, MSG_EVENT);
}
}

View file

@ -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>

View file

@ -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,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)

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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,7 +77,8 @@ alliance *makealliance(int id, const char *name)
al->id = id;
if (name) {
al->name = _strdup(name);
} else {
}
else {
al->flags |= ALF_NON_ALLIED;
}
al->next = alliances;
@ -265,7 +266,8 @@ static void perform_join(void)
setalliance(fj, al);
*tip = ti->next;
free(ti);
} else {
}
else {
/* TODO: error message */
}
}
@ -367,7 +369,8 @@ void setalliance(faction * f, alliance * al)
if (f->alliance->_leader == f) {
if (f->alliance->members) {
f->alliance->_leader = (faction *)ql_get(f->alliance->members, 0);
} else {
}
else {
f->alliance->_leader = NULL;
}
}
@ -392,7 +395,8 @@ const char *alliancename(const alliance * al)
if (al && al->name) {
slprintf(ibuf, sizeof(name), "%s (%s)", al->name, itoa36(al->id));
} else {
}
else {
return NULL;
}
return ibuf;
@ -429,7 +433,8 @@ void alliancevictory(void)
destroyfaction(f);
}
}
} else {
}
else {
freset(al, FFL_MARK);
}
al = al->next;
@ -467,7 +472,8 @@ int victorycondition(const alliance * al, const char *name)
}
return 1;
} else if (strcmp(name, "phoenix") == 0) {
}
else if (strcmp(name, "phoenix") == 0) {
quicklist *flist = al->members;
int qi;
@ -479,7 +485,8 @@ int victorycondition(const alliance * al, const char *name)
}
return 0;
} else if (strcmp(name, "pyramid") == 0) {
}
else if (strcmp(name, "pyramid") == 0) {
/* Logik:
* - if (pyr > last_passed_size && pyr > all_others) {

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

Some files were not shown because too many files have changed in this diff Show more