Auraregeneration in Burgen war kapputt.

Noch ein paar display==NULL Fixes
This commit is contained in:
Enno Rehling 2005-04-23 22:52:49 +00:00
parent fdf61f1845
commit 92de4d4c25
3 changed files with 17 additions and 10 deletions

View File

@ -541,7 +541,7 @@ cr_output_buildings(FILE * F, building * b, unit * u, int fno, faction *f)
} }
fprintf(F, "\"%s\";Typ\n", add_translation(bname, LOC(f->locale, bname))); fprintf(F, "\"%s\";Typ\n", add_translation(bname, LOC(f->locale, bname)));
fprintf(F, "\"%s\";Name\n", b->name); fprintf(F, "\"%s\";Name\n", b->name);
if (strlen(b->display)) if (b->display && strlen(b->display))
fprintf(F, "\"%s\";Beschr\n", b->display); fprintf(F, "\"%s\";Beschr\n", b->display);
if (b->size) if (b->size)
fprintf(F, "%d;Groesse\n", b->size); fprintf(F, "%d;Groesse\n", b->size);
@ -564,12 +564,11 @@ cr_output_buildings(FILE * F, building * b, unit * u, int fno, faction *f)
static void static void
cr_output_ship(FILE * F, const ship * sh, const unit * u, int fcaptain, const faction * f, const region * r) cr_output_ship(FILE * F, const ship * sh, const unit * u, int fcaptain, const faction * f, const region * r)
{ {
unit *u2;
int w = 0; int w = 0;
assert(sh); assert(sh);
fprintf(F, "SCHIFF %d\n", sh->no); fprintf(F, "SCHIFF %d\n", sh->no);
fprintf(F, "\"%s\";Name\n", sh->name); fprintf(F, "\"%s\";Name\n", sh->name);
if (strlen(sh->display)) if (sh->display && strlen(sh->display))
fprintf(F, "\"%s\";Beschr\n", sh->display); fprintf(F, "\"%s\";Beschr\n", sh->display);
fprintf(F, "\"%s\";Typ\n", add_translation(sh->type->name[0], locale_string(f->locale, sh->type->name[0]))); fprintf(F, "\"%s\";Typ\n", add_translation(sh->type->name[0], locale_string(f->locale, sh->type->name[0])));
fprintf(F, "%d;Groesse\n", sh->size); fprintf(F, "%d;Groesse\n", sh->size);
@ -625,7 +624,7 @@ cr_output_unit(FILE * F, const region * r,
fprintf(F, "EINHEIT %d\n", u->no); fprintf(F, "EINHEIT %d\n", u->no);
fprintf(F, "\"%s\";Name\n", u->name); fprintf(F, "\"%s\";Name\n", u->name);
if (strlen(u->display)) if (u->display && strlen(u->display))
fprintf(F, "\"%s\";Beschr\n", u->display); fprintf(F, "\"%s\";Beschr\n", u->display);
{ {

View File

@ -224,7 +224,7 @@ parse_buildings(xmlDocPtr doc)
bt->magres = xml_ivalue(node, "magres", 0); bt->magres = xml_ivalue(node, "magres", 0);
bt->magresbonus = xml_ivalue(node, "magresbonus", 0); bt->magresbonus = xml_ivalue(node, "magresbonus", 0);
bt->fumblebonus = xml_ivalue(node, "fumblebonus", 0); bt->fumblebonus = xml_ivalue(node, "fumblebonus", 0);
bt->auraregen = xml_fvalue(node, "auraregen", 0.0); bt->auraregen = xml_fvalue(node, "auraregen", 1.0);
if (xml_bvalue(node, "nodestroy", false)) bt->flags |= BTF_INDESTRUCTIBLE; if (xml_bvalue(node, "nodestroy", false)) bt->flags |= BTF_INDESTRUCTIBLE;
if (xml_bvalue(node, "nobuild", false)) bt->flags |= BTF_NOBUILD; if (xml_bvalue(node, "nobuild", false)) bt->flags |= BTF_NOBUILD;
@ -331,12 +331,12 @@ parse_ships(xmlDocPtr doc)
st->cargo = xml_ivalue(node, "cargo", 0); st->cargo = xml_ivalue(node, "cargo", 0);
st->combat = xml_ivalue(node, "combat", 0); st->combat = xml_ivalue(node, "combat", 0);
st->cptskill = xml_ivalue(node, "cptskill", 0); st->cptskill = xml_ivalue(node, "cptskill", 0);
st->damage = xml_fvalue(node, "damage", 0); st->damage = xml_fvalue(node, "damage", 0.0);
if (xml_bvalue(node, "fly", false)) st->flags |= SFL_FLY; if (xml_bvalue(node, "fly", false)) st->flags |= SFL_FLY;
if (xml_bvalue(node, "opensea", false)) st->flags |= SFL_OPENSEA; if (xml_bvalue(node, "opensea", false)) st->flags |= SFL_OPENSEA;
st->minskill = xml_ivalue(node, "minskill", 0); st->minskill = xml_ivalue(node, "minskill", 0);
st->range = xml_ivalue(node, "range", 0); st->range = xml_ivalue(node, "range", 0);
st->storm = xml_fvalue(node, "storm", 0.0); st->storm = xml_fvalue(node, "storm", 1.0);
st->sumskill = xml_ivalue(node, "sumskill", 0); st->sumskill = xml_ivalue(node, "sumskill", 0);
/* reading eressea/ships/ship/construction */ /* reading eressea/ships/ship/construction */
@ -787,7 +787,7 @@ parse_races(xmlDocPtr doc)
rc->magres = xml_fvalue(node, "magres", 0.0); rc->magres = xml_fvalue(node, "magres", 0.0);
rc->maxaura = xml_fvalue(node, "maxaura", 0.0); rc->maxaura = xml_fvalue(node, "maxaura", 0.0);
rc->regaura = xml_fvalue(node, "regaura", 0.0); rc->regaura = xml_fvalue(node, "regaura", 1.0);
rc->recruitcost = xml_ivalue(node, "recruitcost", 0); rc->recruitcost = xml_ivalue(node, "recruitcost", 0);
rc->maintenance = xml_ivalue(node, "maintenance", 0); rc->maintenance = xml_ivalue(node, "maintenance", 0);
rc->weight = xml_ivalue(node, "weight", 0); rc->weight = xml_ivalue(node, "weight", 0);

View File

@ -111,8 +111,16 @@ escape_string(const char * str, char * buffer, unsigned int len)
char * char *
set_string (char **s, const char *neu) set_string (char **s, const char *neu)
{ {
if (neu==NULL) {
free(*s);
*s = NULL;
} else if (*s == NULL) {
*s = malloc(strlen(neu)+1);
} else {
*s = realloc(*s, strlen(neu) + 1); *s = realloc(*s, strlen(neu) + 1);
return strcpy(*s, neu); strcpy(*s, neu);
}
return *s;
} }
boolean boolean