Beim schreiben von Attributen etwas Ordnung gemacht.

Einige Attribute haben _nicht_ ihre schreibroutine mit einem space terminiert, was sie müssen, damit es nicht sowas gibt:
road 2 0 0 1 0 50 0end
This commit is contained in:
Enno Rehling 2004-05-31 12:19:26 +00:00
parent b2cec51385
commit bc0e8549b9
10 changed files with 23 additions and 24 deletions

View File

@ -20,7 +20,7 @@
static void static void
write_movement(const attrib * a, FILE * F) write_movement(const attrib * a, FILE * F)
{ {
fprintf(F, "%d", a->data.i); fprintf(F, "%d ", a->data.i);
} }
static int static int

View File

@ -28,7 +28,7 @@ age_moved(attrib * a)
static void static void
write_moved(const attrib * a, FILE * F) write_moved(const attrib * a, FILE * F)
{ {
fprintf(F, "%d", a->data.i); fprintf(F, "%d ", a->data.i);
} }
static int static int

View File

@ -27,7 +27,7 @@ void
write_of(const struct attrib * a, FILE* F) write_of(const struct attrib * a, FILE* F)
{ {
const faction * f = (faction*)a->data.v; const faction * f = (faction*)a->data.v;
fprintf(F, "%d", f->no); fprintf(F, "%d ", f->no);
} }
int int

View File

@ -38,7 +38,6 @@ static int
use_questkey(struct unit * u, const struct item_type * itype, int amount, const char * cmd) use_questkey(struct unit * u, const struct item_type * itype, int amount, const char * cmd)
{ {
border *bo; border *bo;
int key, key1, key2;
region *r1, *r2; region *r1, *r2;
int lock, k; int lock, k;
message *m; message *m;

View File

@ -487,7 +487,7 @@ write_borders(FILE * f)
} }
} }
} }
fputs("end", f); fputs("end ", f);
} }
void void

View File

@ -147,7 +147,7 @@ static void
a_writeicastle(const attrib * a, FILE * f) a_writeicastle(const attrib * a, FILE * f)
{ {
icastle_data * data = (icastle_data*)a->data.v; icastle_data * data = (icastle_data*)a->data.v;
fprintf(f, "%s %d %d", data->type->_name, data->building->no, data->time); fprintf(f, "%s %d %d ", data->type->_name, data->building->no, data->time);
} }
static int static int
@ -252,7 +252,7 @@ write_mage(const attrib * a, FILE * F) {
fprintf (F, "%d ", sp->spellid); fprintf (F, "%d ", sp->spellid);
sp = sp->next; sp = sp->next;
} }
fprintf (F, "-1\n"); fprintf (F, "-1 ");
} }
attrib_type at_mage = { attrib_type at_mage = {

View File

@ -461,7 +461,7 @@ write_enemies(FILE * F, const faction_list * flist)
while (flist) { while (flist) {
fprintf(F, "%s ", itoa36(flist->data->no)); fprintf(F, "%s ", itoa36(flist->data->no));
} }
fputs("end\n", F); fputs("end \n", F);
#endif #endif
} }
#endif #endif
@ -887,7 +887,7 @@ write_alliances(FILE * F)
al = al->next; al = al->next;
wnl(F); wnl(F);
} }
fprintf(F, "end"); fprintf(F, "end ");
wnl(F); wnl(F);
} }
#endif #endif
@ -1483,7 +1483,7 @@ writeregion(FILE * F, const region * r)
ws(F, resourcename(demand->type->itype->rtype, 0)); ws(F, resourcename(demand->type->itype->rtype, 0));
wi(F, demand->value); wi(F, demand->value);
} }
fputs("end\n", F); fputs("end \n", F);
} }
a_write(F, r->attribs); a_write(F, r->attribs);
wnl(F); wnl(F);
@ -1711,7 +1711,7 @@ writefaction(FILE * F, const faction * f)
wi(F, sf->status); wi(F, sf->status);
} }
} }
fprintf(F, "end"); fprintf(F, "end ");
wnl(F); wnl(F);
write_groups(F, f->groups); write_groups(F, f->groups);
#ifdef REGIONOWNERS #ifdef REGIONOWNERS

View File

@ -259,7 +259,7 @@ age_hurting(attrib * a) {
static void static void
write_hurting(const attrib * a, FILE * F) { write_hurting(const attrib * a, FILE * F) {
building * b = a->data.v; building * b = a->data.v;
fprintf(F, "%d", b->no); fprintf(F, "%d ", b->no);
} }
static int static int

View File

@ -97,23 +97,23 @@ make_atpermissions(void)
static void static void
write_gmcreate(const attrib * a, FILE * F) write_gmcreate(const attrib * a, FILE * F)
{ {
const item_type * itype = (const item_type *)a->data.v; const item_type * itype = (const item_type *)a->data.v;
assert(itype); assert(itype);
fprintf(F, "%s", resourcename(itype->rtype, 0)); fprintf(F, "%s ", resourcename(itype->rtype, 0));
} }
static int static int
read_gmcreate(attrib * a, FILE * F) read_gmcreate(attrib * a, FILE * F)
{ {
char zText[32]; char zText[32];
const item_type ** p_itype = (const item_type **)&a->data.v; const item_type ** p_itype = (const item_type **)&a->data.v;
fscanf(F, "%s", zText); fscanf(F, "%s", zText);
*p_itype = it_find(zText); *p_itype = it_find(zText);
if (a->data.v==NULL) { if (a->data.v==NULL) {
log_error(("unknown itemtype %s in gmcreate attribute\n", zText)); log_error(("unknown itemtype %s in gmcreate attribute\n", zText));
return AT_READ_FAIL; return AT_READ_FAIL;
} }
return AT_READ_OK; return AT_READ_OK;
} }
/* at_gmcreate specifies that the owner can create items of a particular type */ /* at_gmcreate specifies that the owner can create items of a particular type */

View File

@ -305,5 +305,5 @@ a_write(FILE * f, const attrib * attribs)
} }
na = na->next; na = na->next;
} }
fprintf(f, "end"); fprintf(f, "end ");
} }