- bugfix fehlender burgenbonus (maxcapacity 4)

- removed old xml-writing code
- fixed a crash related to astralspace

kingdoms:
- building type castle
This commit is contained in:
Enno Rehling 2005-12-11 14:54:50 +00:00
parent a8b9c29be4
commit bbcc80643a
5 changed files with 11 additions and 68 deletions

View File

@ -576,64 +576,3 @@ buildingowner(const region * r, const building * b)
fset(first, UFL_OWNER); fset(first, UFL_OWNER);
return first; return first;
} }
#ifdef BETA_CODE
void
xml_writebuildings(void)
{
FILE * F = fopen("buildings.xml", "w");
building_typelist *btl= buildingtypes;
while (btl) {
int i;
const building_type * bt = btl->type;
fprintf(F, "<building name=\"%s\"", bt->_name);
if (bt->capacity>=0) fprintf(F, " capacity=\"%d\"", bt->capacity);
if (bt->maxcapacity>=0) fprintf(F, " maxcapacity=\"%d\"", bt->maxcapacity);
if (bt->maxsize>=0) fprintf(F, " maxsize=\"%d\"", bt->maxsize);
if (bt->flags & BTF_INDESTRUCTIBLE) fputs(" nodestroy", F);
if (bt->flags & BTF_NOBUILD) fputs(" nobuild", F);
if (bt->flags & BTF_UNIQUE) fputs(" unique", F);
if (bt->flags & BTF_DECAY) fputs(" decay", F);
if (bt->flags & BTF_PROTECTION) fputs(" protection", F);
if (bt->flags & BTF_MAGIC) fputs(" magic", F);
fputs(">\n", F);
if (bt->name) {
const char * name = get_functionname((pf_generic)bt->name);
assert(name);
fprintf(F, "\t<function name=\"name\" value=\"%s\"></function>\n",
name);
}
if (bt->init) {
const char * name = get_functionname((pf_generic)bt->init);
assert(name);
fprintf(F, "\t<function name=\"init\" value=\"%s\"></function>\n",
name);
}
for (i=0;bt->maintenance && bt->maintenance[i].number;++i) {
const maintenance * m = bt->maintenance + i;
fprintf(F, "\t<maintenance type=\"%s\" amount=\"%u\"",
oldresourcetype[m->type]->_name[0], m->number);
if (m->flags & MTF_VARIABLE) fputs(" variable", F);
if (m->flags & MTF_VITAL) fputs(" vital", F);
fputs(">\n", F);
}
if (bt->construction) {
fprintf(F, "\t<construction skill=\"%s\" minskill=\"%u\" reqsize=\"%u\"",
skillname(bt->construction->skill, NULL), bt->construction->minskill,
bt->construction->reqsize);
if (bt->construction->maxsize>=0) fprintf(F, " maxsize=\"%d\"", bt->construction->maxsize);
fputs(">\n", F);
for (i=0;bt->construction->materials[i].number!=0;++i) {
fprintf(F, "\t\t<requirement type=\"%s\" quantity=\"%d\"></requirement>\n",
oldresourcetype[bt->construction->materials[i].type]->_name[0],
bt->construction->materials[i].number);
}
fputs("\t</construction>\n", F);
}
fputs("</building>\n\n", F);
btl=btl->next;
}
fclose(F);
}
#endif

View File

@ -219,10 +219,13 @@ give_starting_equipment(struct unit *u)
break; break;
case RC_HUMAN: case RC_HUMAN:
{ {
building *b = new_building(bt_find("castle"), r, u->faction->locale); const building_type * btype = bt_find("castle");
b->size = 10; if (btype!=NULL) {
u->building = b; building *b = new_building(btype, r, u->faction->locale);
fset(u, UFL_OWNER); b->size = 10;
u->building = b;
fset(u, UFL_OWNER);
}
} }
break; break;
case RC_CAT: case RC_CAT:

View File

@ -96,7 +96,7 @@ r_standard_to_astral(const region *r)
if (rplane(r) != get_normalplane()) return NULL; if (rplane(r) != get_normalplane()) return NULL;
r2 = tpregion(r); r2 = tpregion(r);
if (fval(r2->terrain, FORBIDDEN_REGION)) return NULL; if (r2==NULL || fval(r2->terrain, FORBIDDEN_REGION)) return NULL;
return r2; return r2;
} }
@ -112,7 +112,7 @@ r_astral_to_standard(const region *r)
y = (r->y-TE_CENTER_Y)*TP_DISTANCE; y = (r->y-TE_CENTER_Y)*TP_DISTANCE;
r2 = findregion(x,y); r2 = findregion(x,y);
if (rplane(r2)!=get_normalplane()) return NULL; if (r2==NULL || rplane(r2)!=get_normalplane()) return NULL;
return r2; return r2;
} }

View File

@ -166,7 +166,7 @@
</construction> </construction>
</building> </building>
<building name="castle" capacity="1" maxcapacity="4"> <building name="castle" capacity="1">
<function name="name" value="castle_name"/> <function name="name" value="castle_name"/>
<construction skill="building" minskill="1" maxsize="2" reqsize="1"> <construction skill="building" minskill="1" maxsize="2" reqsize="1">
<requirement type="stone" quantity="1" recycle="0.5"/> <requirement type="stone" quantity="1" recycle="0.5"/>

View File

@ -12,6 +12,7 @@
<xi:include href="calendar.xml"/> <xi:include href="calendar.xml"/>
<xi:include href="kingdoms/terrains.xml"/> <xi:include href="kingdoms/terrains.xml"/>
<xi:include href="kingdoms/equipment.xml"/> <xi:include href="kingdoms/equipment.xml"/>
<xi:include href="kingdoms/buildings.xml"/>
<equipment> <equipment>
<set name="new_faction"> <set name="new_faction">