forked from github/server
indentation fixes (tab->spaces)
This commit is contained in:
parent
9b42824a5e
commit
3ba2b3d4d7
76
src/battle.c
76
src/battle.c
|
@ -4236,48 +4236,48 @@ static void battle_flee(battle * b)
|
|||
}
|
||||
|
||||
static bool is_enemy(battle *b, unit *u1, unit *u2) {
|
||||
if (u1->faction != u2->faction) {
|
||||
if (b) {
|
||||
side *es, *s1 = 0, *s2 = 0;
|
||||
for (es = b->sides; es != b->sides + b->nsides; ++es) {
|
||||
if (!s1 && es->faction == u1->faction) s1 = es;
|
||||
else if (!s2 && es->faction == u2->faction) s2 = es;
|
||||
if (s1 && s2) break;
|
||||
}
|
||||
return enemy(s1, s2);
|
||||
}
|
||||
else {
|
||||
return !help_enter(u1, u2);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
if (u1->faction != u2->faction) {
|
||||
if (b) {
|
||||
side *es, *s1 = 0, *s2 = 0;
|
||||
for (es = b->sides; es != b->sides + b->nsides; ++es) {
|
||||
if (!s1 && es->faction == u1->faction) s1 = es;
|
||||
else if (!s2 && es->faction == u2->faction) s2 = es;
|
||||
if (s1 && s2) break;
|
||||
}
|
||||
return enemy(s1, s2);
|
||||
}
|
||||
else {
|
||||
return !help_enter(u1, u2);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void force_leave(region *r, battle *b) {
|
||||
unit *u;
|
||||
unit *u;
|
||||
|
||||
for (u = r->units; u; u = u->next) {
|
||||
unit *uo = NULL;
|
||||
if (u->building) {
|
||||
uo = building_owner(u->building);
|
||||
}
|
||||
if (u->ship && r->land) {
|
||||
uo = ship_owner(u->ship);
|
||||
}
|
||||
if (uo && is_enemy(b, uo, u)) {
|
||||
message *msg = NULL;
|
||||
if (u->building) {
|
||||
msg = msg_message("force_leave_building", "unit owner building", u, uo, u->building);
|
||||
}
|
||||
else {
|
||||
msg = msg_message("force_leave_ship", "unit owner ship", u, uo, u->ship);
|
||||
}
|
||||
if (msg) {
|
||||
ADDMSG(&u->faction->msgs, msg);
|
||||
}
|
||||
leave(u, false);
|
||||
}
|
||||
}
|
||||
for (u = r->units; u; u = u->next) {
|
||||
unit *uo = NULL;
|
||||
if (u->building) {
|
||||
uo = building_owner(u->building);
|
||||
}
|
||||
if (u->ship && r->land) {
|
||||
uo = ship_owner(u->ship);
|
||||
}
|
||||
if (uo && is_enemy(b, uo, u)) {
|
||||
message *msg = NULL;
|
||||
if (u->building) {
|
||||
msg = msg_message("force_leave_building", "unit owner building", u, uo, u->building);
|
||||
}
|
||||
else {
|
||||
msg = msg_message("force_leave_ship", "unit owner ship", u, uo, u->ship);
|
||||
}
|
||||
if (msg) {
|
||||
ADDMSG(&u->faction->msgs, msg);
|
||||
}
|
||||
leave(u, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -130,13 +130,13 @@ extern "C" {
|
|||
} weapon;
|
||||
|
||||
/*** fighter::person::flags ***/
|
||||
#define FL_TIRED 1
|
||||
#define FL_TIRED 1
|
||||
#define FL_DAZZLED 2 /* durch Untote oder Dämonen eingeschüchtert */
|
||||
#define FL_PANICED 4
|
||||
#define FL_COURAGE 8 /* Helden fliehen nie */
|
||||
#define FL_SLEEPING 16
|
||||
#define FL_STUNNED 32 /* eine Runde keinen Angriff */
|
||||
#define FL_HIT 64 /* the person at attacked */
|
||||
#define FL_STUNNED 32 /* eine Runde keinen Angriff */
|
||||
#define FL_HIT 64 /* the person at attacked */
|
||||
|
||||
typedef struct troop {
|
||||
struct fighter *fighter;
|
||||
|
@ -270,7 +270,7 @@ extern "C" {
|
|||
const struct group * g, unsigned int flags,
|
||||
const struct faction * stealthfaction);
|
||||
int skilldiff(troop at, troop dt, int dist);
|
||||
void force_leave(struct region *r, struct battle *b);
|
||||
void force_leave(struct region *r, struct battle *b);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
+-------------------+
|
||||
| | Enno Rehling <enno@eressea.de>
|
||||
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
@ -191,13 +191,13 @@ 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 (!r) {
|
||||
log_error("building.create expects a region as argument 1");
|
||||
}
|
||||
if (!bname) {
|
||||
log_error("building.create expects a name as argument 2");
|
||||
}
|
||||
if (bname) {
|
||||
if (!r) {
|
||||
log_error("building.create expects a region as argument 1");
|
||||
}
|
||||
if (!bname) {
|
||||
log_error("building.create expects a name as argument 2");
|
||||
}
|
||||
if (bname) {
|
||||
const building_type *btype = bt_find(bname);
|
||||
if (btype) {
|
||||
building *b = new_building(btype, r, default_locale);
|
||||
|
|
|
@ -1441,13 +1441,13 @@ static void cr_output_region(FILE * F, report_context * ctx, seen_region * sr)
|
|||
}
|
||||
}
|
||||
if (sr->mode == see_unit || sr->mode == see_travel) {
|
||||
cr_output_messages(F, r->msgs, f);
|
||||
{
|
||||
message_list *mlist = r_getmessages(r, f);
|
||||
if (mlist)
|
||||
cr_output_messages(F, mlist, f);
|
||||
}
|
||||
}
|
||||
cr_output_messages(F, r->msgs, f);
|
||||
{
|
||||
message_list *mlist = r_getmessages(r, f);
|
||||
if (mlist)
|
||||
cr_output_messages(F, mlist, f);
|
||||
}
|
||||
}
|
||||
/* buildings */
|
||||
for (b = rbuildings(r); b; b = b->next) {
|
||||
int fno = -1;
|
||||
|
|
|
@ -183,7 +183,7 @@ race *rc_get_or_create(const char *zName)
|
|||
rc->recruit_multi = 1.0F;
|
||||
rc->regaura = 1.0F;
|
||||
rc->speed = 1.0F;
|
||||
rc->battle_flags = BF_CANATTACK;
|
||||
rc->battle_flags = BF_CANATTACK;
|
||||
if (strchr(zName, ' ') != NULL) {
|
||||
log_error("race '%s' has an invalid name. remove spaces\n", zName);
|
||||
assert(strchr(zName, ' ') == NULL);
|
||||
|
|
14
src/laws.c
14
src/laws.c
|
@ -4312,7 +4312,7 @@ bool help_enter(unit *uo, unit *u) {
|
|||
}
|
||||
|
||||
static void do_force_leave(region *r) {
|
||||
force_leave(r, NULL);
|
||||
force_leave(r, NULL);
|
||||
}
|
||||
|
||||
bool rule_force_leave(int flags) {
|
||||
|
@ -4356,11 +4356,11 @@ void init_processor(void)
|
|||
{
|
||||
int p;
|
||||
|
||||
while (processors) {
|
||||
processor * next = processors->next;
|
||||
free(processors);
|
||||
processors = next;
|
||||
}
|
||||
while (processors) {
|
||||
processor * next = processors->next;
|
||||
free(processors);
|
||||
processors = next;
|
||||
}
|
||||
|
||||
p = 10;
|
||||
add_proc_global(p, new_units, "Neue Einheiten erschaffen");
|
||||
|
@ -4514,7 +4514,7 @@ void processorders(void)
|
|||
{
|
||||
init_processor();
|
||||
|
||||
update_spells();
|
||||
update_spells();
|
||||
process();
|
||||
/*************************************************/
|
||||
|
||||
|
|
|
@ -114,18 +114,18 @@ const char *combatstatus[] = {
|
|||
const char *report_kampfstatus(const unit * u, const struct locale *lang)
|
||||
{
|
||||
static char fsbuf[64]; // FIXME: static return value
|
||||
const char * status = LOC(lang, combatstatus[u->status]);
|
||||
const char * status = LOC(lang, combatstatus[u->status]);
|
||||
|
||||
if (!status) {
|
||||
const char *lname = locale_name(lang);
|
||||
struct locale *wloc = get_or_create_locale(lname);
|
||||
log_error("no translation for combat status %s in %s", combatstatus[u->status], lname);
|
||||
locale_setstring(wloc, combatstatus[u->status], combatstatus[u->status]);
|
||||
strlcpy(fsbuf, combatstatus[u->status], sizeof(fsbuf));
|
||||
}
|
||||
else {
|
||||
strlcpy(fsbuf, status, sizeof(fsbuf));
|
||||
}
|
||||
if (!status) {
|
||||
const char *lname = locale_name(lang);
|
||||
struct locale *wloc = get_or_create_locale(lname);
|
||||
log_error("no translation for combat status %s in %s", combatstatus[u->status], lname);
|
||||
locale_setstring(wloc, combatstatus[u->status], combatstatus[u->status]);
|
||||
strlcpy(fsbuf, combatstatus[u->status], sizeof(fsbuf));
|
||||
}
|
||||
else {
|
||||
strlcpy(fsbuf, status, sizeof(fsbuf));
|
||||
}
|
||||
if (fval(u, UFL_NOAID)) {
|
||||
strcat(fsbuf, ", ");
|
||||
strcat(fsbuf, LOC(lang, "status_noaid"));
|
||||
|
@ -139,7 +139,7 @@ const char *hp_status(const unit * u)
|
|||
double p;
|
||||
int max_hp = u->number * unit_max_hp(u);
|
||||
|
||||
if (u->hp == max_hp)
|
||||
if (u->hp == max_hp)
|
||||
return NULL;
|
||||
|
||||
p = (double)((double)u->hp / (double)(max_hp));
|
||||
|
@ -978,7 +978,7 @@ void split_paragraph(strlist ** SP, const char *s, unsigned int indent, unsigned
|
|||
|
||||
assert(width <= REPORTWIDTH);
|
||||
width -= indent;
|
||||
firstline = (mark!=0 && indent>2);
|
||||
firstline = (mark != 0 && indent > 2);
|
||||
*SP = 0;
|
||||
|
||||
while (len > 0) {
|
||||
|
@ -1002,7 +1002,7 @@ void split_paragraph(strlist ** SP, const char *s, unsigned int indent, unsigned
|
|||
if (!cut) {
|
||||
cut = s + _min(len, REPORTWIDTH);
|
||||
}
|
||||
strncpy(buf+indent, s, cut - s);
|
||||
strncpy(buf + indent, s, cut - s);
|
||||
buf[indent + (cut - s)] = 0;
|
||||
addstrlist(SP, buf); // TODO: too much string copying, cut out this function
|
||||
while (*cut == ' ') {
|
||||
|
@ -2445,7 +2445,7 @@ static void eval_trail(struct opstack **stack, const void *userdata)
|
|||
}
|
||||
}
|
||||
*bufp = 0;
|
||||
var.v = strcpy(balloc((size_t)(bufp - buf +1)), buf);
|
||||
var.v = strcpy(balloc((size_t)(bufp - buf + 1)), buf);
|
||||
opush(stack, var);
|
||||
#ifdef _SECURECRT_ERRCODE_VALUES_DEFINED
|
||||
if (errno == ERANGE) {
|
||||
|
|
|
@ -31,7 +31,7 @@ size_t strlcpy(char *dst, const char *src, size_t siz)
|
|||
register const char *s = src;
|
||||
register size_t n = siz;
|
||||
|
||||
assert(src && dst);
|
||||
assert(src && dst);
|
||||
/* Copy as many bytes as will fit */
|
||||
if (n != 0 && --n != 0) {
|
||||
do {
|
||||
|
|
Loading…
Reference in New Issue