From bbcc80643aa094a2bcca8d32c3e5aec5cf50cee5 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 11 Dec 2005 14:54:50 +0000 Subject: [PATCH] - bugfix fehlender burgenbonus (maxcapacity 4) - removed old xml-writing code - fixed a crash related to astralspace kingdoms: - building type castle --- src/common/kernel/building.c | 61 ------------------------------------ src/common/kernel/race.c | 11 ++++--- src/common/kernel/teleport.c | 4 +-- src/res/buildings.xml | 2 +- src/res/kingdoms.xml | 1 + 5 files changed, 11 insertions(+), 68 deletions(-) diff --git a/src/common/kernel/building.c b/src/common/kernel/building.c index c08e45f06..aaa9b974c 100644 --- a/src/common/kernel/building.c +++ b/src/common/kernel/building.c @@ -576,64 +576,3 @@ buildingowner(const region * r, const building * b) fset(first, UFL_OWNER); 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, "_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\n", - name); - } - if (bt->init) { - const char * name = get_functionname((pf_generic)bt->init); - assert(name); - fprintf(F, "\t\n", - name); - } - for (i=0;bt->maintenance && bt->maintenance[i].number;++i) { - const maintenance * m = bt->maintenance + i; - fprintf(F, "\ttype]->_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, "\tconstruction->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\n", - oldresourcetype[bt->construction->materials[i].type]->_name[0], - bt->construction->materials[i].number); - } - fputs("\t\n", F); - } - fputs("\n\n", F); - btl=btl->next; - } - fclose(F); -} - -#endif diff --git a/src/common/kernel/race.c b/src/common/kernel/race.c index 7027dbe13..3491c4421 100644 --- a/src/common/kernel/race.c +++ b/src/common/kernel/race.c @@ -219,10 +219,13 @@ give_starting_equipment(struct unit *u) break; case RC_HUMAN: { - building *b = new_building(bt_find("castle"), r, u->faction->locale); - b->size = 10; - u->building = b; - fset(u, UFL_OWNER); + const building_type * btype = bt_find("castle"); + if (btype!=NULL) { + building *b = new_building(btype, r, u->faction->locale); + b->size = 10; + u->building = b; + fset(u, UFL_OWNER); + } } break; case RC_CAT: diff --git a/src/common/kernel/teleport.c b/src/common/kernel/teleport.c index f8d395229..e1f7f482a 100644 --- a/src/common/kernel/teleport.c +++ b/src/common/kernel/teleport.c @@ -96,7 +96,7 @@ r_standard_to_astral(const region *r) if (rplane(r) != get_normalplane()) return NULL; r2 = tpregion(r); - if (fval(r2->terrain, FORBIDDEN_REGION)) return NULL; + if (r2==NULL || fval(r2->terrain, FORBIDDEN_REGION)) return NULL; return r2; } @@ -112,7 +112,7 @@ r_astral_to_standard(const region *r) y = (r->y-TE_CENTER_Y)*TP_DISTANCE; r2 = findregion(x,y); - if (rplane(r2)!=get_normalplane()) return NULL; + if (r2==NULL || rplane(r2)!=get_normalplane()) return NULL; return r2; } diff --git a/src/res/buildings.xml b/src/res/buildings.xml index 60bf4168e..da1b1c01e 100644 --- a/src/res/buildings.xml +++ b/src/res/buildings.xml @@ -166,7 +166,7 @@ - + diff --git a/src/res/kingdoms.xml b/src/res/kingdoms.xml index eb3962a98..491f76f58 100644 --- a/src/res/kingdoms.xml +++ b/src/res/kingdoms.xml @@ -12,6 +12,7 @@ +