indentation fixes (tab->spaces)

This commit is contained in:
Enno Rehling 2015-06-26 14:31:21 +02:00
parent 9b42824a5e
commit 3ba2b3d4d7
8 changed files with 81 additions and 81 deletions

View File

@ -4236,48 +4236,48 @@ static void battle_flee(battle * b)
} }
static bool is_enemy(battle *b, unit *u1, unit *u2) { static bool is_enemy(battle *b, unit *u1, unit *u2) {
if (u1->faction != u2->faction) { if (u1->faction != u2->faction) {
if (b) { if (b) {
side *es, *s1 = 0, *s2 = 0; side *es, *s1 = 0, *s2 = 0;
for (es = b->sides; es != b->sides + b->nsides; ++es) { for (es = b->sides; es != b->sides + b->nsides; ++es) {
if (!s1 && es->faction == u1->faction) s1 = es; if (!s1 && es->faction == u1->faction) s1 = es;
else if (!s2 && es->faction == u2->faction) s2 = es; else if (!s2 && es->faction == u2->faction) s2 = es;
if (s1 && s2) break; if (s1 && s2) break;
} }
return enemy(s1, s2); return enemy(s1, s2);
} }
else { else {
return !help_enter(u1, u2); return !help_enter(u1, u2);
} }
} }
return false; return false;
} }
void force_leave(region *r, battle *b) { void force_leave(region *r, battle *b) {
unit *u; unit *u;
for (u = r->units; u; u = u->next) { for (u = r->units; u; u = u->next) {
unit *uo = NULL; unit *uo = NULL;
if (u->building) { if (u->building) {
uo = building_owner(u->building); uo = building_owner(u->building);
} }
if (u->ship && r->land) { if (u->ship && r->land) {
uo = ship_owner(u->ship); uo = ship_owner(u->ship);
} }
if (uo && is_enemy(b, uo, u)) { if (uo && is_enemy(b, uo, u)) {
message *msg = NULL; message *msg = NULL;
if (u->building) { if (u->building) {
msg = msg_message("force_leave_building", "unit owner building", u, uo, u->building); msg = msg_message("force_leave_building", "unit owner building", u, uo, u->building);
} }
else { else {
msg = msg_message("force_leave_ship", "unit owner ship", u, uo, u->ship); msg = msg_message("force_leave_ship", "unit owner ship", u, uo, u->ship);
} }
if (msg) { if (msg) {
ADDMSG(&u->faction->msgs, msg); ADDMSG(&u->faction->msgs, msg);
} }
leave(u, false); leave(u, false);
} }
} }
} }

View File

@ -130,13 +130,13 @@ extern "C" {
} weapon; } weapon;
/*** fighter::person::flags ***/ /*** fighter::person::flags ***/
#define FL_TIRED 1 #define FL_TIRED 1
#define FL_DAZZLED 2 /* durch Untote oder Dämonen eingeschüchtert */ #define FL_DAZZLED 2 /* durch Untote oder Dämonen eingeschüchtert */
#define FL_PANICED 4 #define FL_PANICED 4
#define FL_COURAGE 8 /* Helden fliehen nie */ #define FL_COURAGE 8 /* Helden fliehen nie */
#define FL_SLEEPING 16 #define FL_SLEEPING 16
#define FL_STUNNED 32 /* eine Runde keinen Angriff */ #define FL_STUNNED 32 /* eine Runde keinen Angriff */
#define FL_HIT 64 /* the person at attacked */ #define FL_HIT 64 /* the person at attacked */
typedef struct troop { typedef struct troop {
struct fighter *fighter; struct fighter *fighter;
@ -270,7 +270,7 @@ extern "C" {
const struct group * g, unsigned int flags, const struct group * g, unsigned int flags,
const struct faction * stealthfaction); const struct faction * stealthfaction);
int skilldiff(troop at, troop dt, int dist); 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 #ifdef __cplusplus
} }

View File

@ -191,13 +191,13 @@ static int tolua_building_create(lua_State * L)
{ {
region *r = (region *)tolua_tousertype(L, 1, 0); region *r = (region *)tolua_tousertype(L, 1, 0);
const char *bname = tolua_tostring(L, 2, 0); const char *bname = tolua_tostring(L, 2, 0);
if (!r) { if (!r) {
log_error("building.create expects a region as argument 1"); log_error("building.create expects a region as argument 1");
} }
if (!bname) { if (!bname) {
log_error("building.create expects a name as argument 2"); log_error("building.create expects a name as argument 2");
} }
if (bname) { if (bname) {
const building_type *btype = bt_find(bname); const building_type *btype = bt_find(bname);
if (btype) { if (btype) {
building *b = new_building(btype, r, default_locale); building *b = new_building(btype, r, default_locale);

View File

@ -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) { if (sr->mode == see_unit || sr->mode == see_travel) {
cr_output_messages(F, r->msgs, f); cr_output_messages(F, r->msgs, f);
{ {
message_list *mlist = r_getmessages(r, f); message_list *mlist = r_getmessages(r, f);
if (mlist) if (mlist)
cr_output_messages(F, mlist, f); cr_output_messages(F, mlist, f);
} }
} }
/* buildings */ /* buildings */
for (b = rbuildings(r); b; b = b->next) { for (b = rbuildings(r); b; b = b->next) {
int fno = -1; int fno = -1;

View File

@ -183,7 +183,7 @@ race *rc_get_or_create(const char *zName)
rc->recruit_multi = 1.0F; rc->recruit_multi = 1.0F;
rc->regaura = 1.0F; rc->regaura = 1.0F;
rc->speed = 1.0F; rc->speed = 1.0F;
rc->battle_flags = BF_CANATTACK; rc->battle_flags = BF_CANATTACK;
if (strchr(zName, ' ') != NULL) { if (strchr(zName, ' ') != NULL) {
log_error("race '%s' has an invalid name. remove spaces\n", zName); log_error("race '%s' has an invalid name. remove spaces\n", zName);
assert(strchr(zName, ' ') == NULL); assert(strchr(zName, ' ') == NULL);

View File

@ -4312,7 +4312,7 @@ bool help_enter(unit *uo, unit *u) {
} }
static void do_force_leave(region *r) { static void do_force_leave(region *r) {
force_leave(r, NULL); force_leave(r, NULL);
} }
bool rule_force_leave(int flags) { bool rule_force_leave(int flags) {
@ -4356,11 +4356,11 @@ void init_processor(void)
{ {
int p; int p;
while (processors) { while (processors) {
processor * next = processors->next; processor * next = processors->next;
free(processors); free(processors);
processors = next; processors = next;
} }
p = 10; p = 10;
add_proc_global(p, new_units, "Neue Einheiten erschaffen"); add_proc_global(p, new_units, "Neue Einheiten erschaffen");
@ -4514,7 +4514,7 @@ void processorders(void)
{ {
init_processor(); init_processor();
update_spells(); update_spells();
process(); process();
/*************************************************/ /*************************************************/

View File

@ -114,18 +114,18 @@ const char *combatstatus[] = {
const char *report_kampfstatus(const unit * u, const struct locale *lang) const char *report_kampfstatus(const unit * u, const struct locale *lang)
{ {
static char fsbuf[64]; // FIXME: static return value 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) { if (!status) {
const char *lname = locale_name(lang); const char *lname = locale_name(lang);
struct locale *wloc = get_or_create_locale(lname); struct locale *wloc = get_or_create_locale(lname);
log_error("no translation for combat status %s in %s", combatstatus[u->status], lname); log_error("no translation for combat status %s in %s", combatstatus[u->status], lname);
locale_setstring(wloc, combatstatus[u->status], combatstatus[u->status]); locale_setstring(wloc, combatstatus[u->status], combatstatus[u->status]);
strlcpy(fsbuf, combatstatus[u->status], sizeof(fsbuf)); strlcpy(fsbuf, combatstatus[u->status], sizeof(fsbuf));
} }
else { else {
strlcpy(fsbuf, status, sizeof(fsbuf)); strlcpy(fsbuf, status, sizeof(fsbuf));
} }
if (fval(u, UFL_NOAID)) { if (fval(u, UFL_NOAID)) {
strcat(fsbuf, ", "); strcat(fsbuf, ", ");
strcat(fsbuf, LOC(lang, "status_noaid")); strcat(fsbuf, LOC(lang, "status_noaid"));
@ -139,7 +139,7 @@ const char *hp_status(const unit * u)
double p; double p;
int max_hp = u->number * unit_max_hp(u); int max_hp = u->number * unit_max_hp(u);
if (u->hp == max_hp) if (u->hp == max_hp)
return NULL; return NULL;
p = (double)((double)u->hp / (double)(max_hp)); 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); assert(width <= REPORTWIDTH);
width -= indent; width -= indent;
firstline = (mark!=0 && indent>2); firstline = (mark != 0 && indent > 2);
*SP = 0; *SP = 0;
while (len > 0) { while (len > 0) {
@ -1002,7 +1002,7 @@ void split_paragraph(strlist ** SP, const char *s, unsigned int indent, unsigned
if (!cut) { if (!cut) {
cut = s + _min(len, REPORTWIDTH); cut = s + _min(len, REPORTWIDTH);
} }
strncpy(buf+indent, s, cut - s); strncpy(buf + indent, s, cut - s);
buf[indent + (cut - s)] = 0; buf[indent + (cut - s)] = 0;
addstrlist(SP, buf); // TODO: too much string copying, cut out this function addstrlist(SP, buf); // TODO: too much string copying, cut out this function
while (*cut == ' ') { while (*cut == ' ') {
@ -2445,7 +2445,7 @@ static void eval_trail(struct opstack **stack, const void *userdata)
} }
} }
*bufp = 0; *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); opush(stack, var);
#ifdef _SECURECRT_ERRCODE_VALUES_DEFINED #ifdef _SECURECRT_ERRCODE_VALUES_DEFINED
if (errno == ERANGE) { if (errno == ERANGE) {

View File

@ -31,7 +31,7 @@ size_t strlcpy(char *dst, const char *src, size_t siz)
register const char *s = src; register const char *s = src;
register size_t n = siz; register size_t n = siz;
assert(src && dst); assert(src && dst);
/* Copy as many bytes as will fit */ /* Copy as many bytes as will fit */
if (n != 0 && --n != 0) { if (n != 0 && --n != 0) {
do { do {