- building sizes adjusted
This commit is contained in:
Enno Rehling 2009-07-15 20:50:40 +00:00
parent 2ed29bfc15
commit 8ed0e8349a
4 changed files with 20 additions and 30 deletions

View file

@ -255,15 +255,8 @@ init_smithy(struct building_type * bt)
static const char *
castle_name_i(const struct building_type* btype, int bsize, const char * fname[])
{
const construction * ctype;
int i = 0;
int i = bt_effsize(btype, bsize);
ctype = btype->construction;
while (ctype && ctype->maxsize != -1 && ctype->maxsize<=bsize) {
bsize-=ctype->maxsize;
ctype=ctype->improvement;
++i;
}
return fname[i];
}
@ -304,16 +297,7 @@ fort_name(const struct building_type* btype, int bsize)
"guardhouse",
"guardtower",
};
const construction * ctype;
int i = 0;
ctype = btype->construction;
while (ctype && ctype->maxsize != -1 && ctype->maxsize<=bsize) {
bsize-=ctype->maxsize;
ctype=ctype->improvement;
++i;
}
return fname[i];
return castle_name_i(btype, bsize, fname);
}
#ifdef WDW_PYRAMID
@ -577,8 +561,6 @@ extern struct attrib_type at_icastle;
int
buildingeffsize(const building * b, boolean img)
{
int i = b->size, n = 0;
const construction * cons;
const struct building_type * btype = NULL;
if (b==NULL) return 0;
@ -590,7 +572,14 @@ buildingeffsize(const building * b, boolean img)
btype = (const struct building_type *)a->data.v;
}
}
cons = btype->construction;
return bt_effsize(btype, b->size);
}
int bt_effsize(const building_type * btype, int bsize)
{
int i = bsize, n = 0;
const construction * cons = btype->construction;
if (!cons || !cons->improvement) {
return 0;
}

View file

@ -67,7 +67,8 @@ typedef struct building_type {
extern building_type * bt_find(const char* name);
extern void register_buildings(void);
extern void bt_register(building_type * type);
extern void bt_register(struct building_type * type);
extern int bt_effsize(const struct building_type * btype, int bsize);
/* buildingt => building_type
* Name => locale_string(name)

View file

@ -3,19 +3,19 @@
<function name="name" value="castle_name_2"/>
<function name="protection" value="lua_building_protection"/>
<function name="taxes" value="lua_building_taxes"/>
<construction skill="building" minskill="1" maxsize="9" reqsize="1">
<construction skill="building" minskill="1" maxsize="10" reqsize="1">
<requirement type="stone" quantity="1"/>
</construction>
<construction skill="building" minskill="2" maxsize="49" reqsize="1">
<construction skill="building" minskill="2" maxsize="40" reqsize="1">
<requirement type="stone" quantity="1"/>
</construction>
<construction skill="building" minskill="3" maxsize="249" reqsize="1">
<construction skill="building" minskill="3" maxsize="200" reqsize="1">
<requirement type="stone" quantity="1"/>
</construction>
<construction skill="building" minskill="4" maxsize="1249" reqsize="1">
<construction skill="building" minskill="4" maxsize="1000" reqsize="1">
<requirement type="stone" quantity="1"/>
</construction>
<construction skill="building" minskill="5" maxsize="6249" reqsize="1">
<construction skill="building" minskill="5" maxsize="5000" reqsize="1">
<requirement type="stone" quantity="1"/>
</construction>
<construction skill="building" minskill="6" reqsize="1">

View file

@ -7,13 +7,13 @@
<function name="name" value="fort_name"/>
<function name="protection" value="lua_building_protection"/>
<function name="taxes" value="lua_building_taxes"/>
<construction skill="building" minskill="1" maxsize="4" reqsize="1">
<construction skill="building" minskill="1" maxsize="5" reqsize="1">
<requirement type="log" quantity="1"/>
</construction>
<construction skill="building" minskill="2" maxsize="9" reqsize="1">
<construction skill="building" minskill="2" maxsize="5" reqsize="1">
<requirement type="log" quantity="1"/>
</construction>
<construction skill="building" minskill="2" maxsize="10" reqsize="1">
<construction skill="building" minskill="2" reqsize="1">
<requirement type="log" quantity="1"/>
</construction>
</building>