forked from github/server
parent
2ed29bfc15
commit
8ed0e8349a
4 changed files with 20 additions and 30 deletions
|
@ -255,15 +255,8 @@ init_smithy(struct building_type * bt)
|
||||||
static const char *
|
static const char *
|
||||||
castle_name_i(const struct building_type* btype, int bsize, const char * fname[])
|
castle_name_i(const struct building_type* btype, int bsize, const char * fname[])
|
||||||
{
|
{
|
||||||
const construction * ctype;
|
int i = bt_effsize(btype, bsize);
|
||||||
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 fname[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,16 +297,7 @@ fort_name(const struct building_type* btype, int bsize)
|
||||||
"guardhouse",
|
"guardhouse",
|
||||||
"guardtower",
|
"guardtower",
|
||||||
};
|
};
|
||||||
const construction * ctype;
|
return castle_name_i(btype, bsize, fname);
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
ctype = btype->construction;
|
|
||||||
while (ctype && ctype->maxsize != -1 && ctype->maxsize<=bsize) {
|
|
||||||
bsize-=ctype->maxsize;
|
|
||||||
ctype=ctype->improvement;
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
return fname[i];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WDW_PYRAMID
|
#ifdef WDW_PYRAMID
|
||||||
|
@ -577,8 +561,6 @@ extern struct attrib_type at_icastle;
|
||||||
int
|
int
|
||||||
buildingeffsize(const building * b, boolean img)
|
buildingeffsize(const building * b, boolean img)
|
||||||
{
|
{
|
||||||
int i = b->size, n = 0;
|
|
||||||
const construction * cons;
|
|
||||||
const struct building_type * btype = NULL;
|
const struct building_type * btype = NULL;
|
||||||
|
|
||||||
if (b==NULL) return 0;
|
if (b==NULL) return 0;
|
||||||
|
@ -590,7 +572,14 @@ buildingeffsize(const building * b, boolean img)
|
||||||
btype = (const struct building_type *)a->data.v;
|
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) {
|
if (!cons || !cons->improvement) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,8 @@ typedef struct building_type {
|
||||||
|
|
||||||
extern building_type * bt_find(const char* name);
|
extern building_type * bt_find(const char* name);
|
||||||
extern void register_buildings(void);
|
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
|
/* buildingt => building_type
|
||||||
* Name => locale_string(name)
|
* Name => locale_string(name)
|
||||||
|
|
|
@ -3,19 +3,19 @@
|
||||||
<function name="name" value="castle_name_2"/>
|
<function name="name" value="castle_name_2"/>
|
||||||
<function name="protection" value="lua_building_protection"/>
|
<function name="protection" value="lua_building_protection"/>
|
||||||
<function name="taxes" value="lua_building_taxes"/>
|
<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"/>
|
<requirement type="stone" quantity="1"/>
|
||||||
</construction>
|
</construction>
|
||||||
<construction skill="building" minskill="2" maxsize="49" reqsize="1">
|
<construction skill="building" minskill="2" maxsize="40" reqsize="1">
|
||||||
<requirement type="stone" quantity="1"/>
|
<requirement type="stone" quantity="1"/>
|
||||||
</construction>
|
</construction>
|
||||||
<construction skill="building" minskill="3" maxsize="249" reqsize="1">
|
<construction skill="building" minskill="3" maxsize="200" reqsize="1">
|
||||||
<requirement type="stone" quantity="1"/>
|
<requirement type="stone" quantity="1"/>
|
||||||
</construction>
|
</construction>
|
||||||
<construction skill="building" minskill="4" maxsize="1249" reqsize="1">
|
<construction skill="building" minskill="4" maxsize="1000" reqsize="1">
|
||||||
<requirement type="stone" quantity="1"/>
|
<requirement type="stone" quantity="1"/>
|
||||||
</construction>
|
</construction>
|
||||||
<construction skill="building" minskill="5" maxsize="6249" reqsize="1">
|
<construction skill="building" minskill="5" maxsize="5000" reqsize="1">
|
||||||
<requirement type="stone" quantity="1"/>
|
<requirement type="stone" quantity="1"/>
|
||||||
</construction>
|
</construction>
|
||||||
<construction skill="building" minskill="6" reqsize="1">
|
<construction skill="building" minskill="6" reqsize="1">
|
||||||
|
|
|
@ -7,13 +7,13 @@
|
||||||
<function name="name" value="fort_name"/>
|
<function name="name" value="fort_name"/>
|
||||||
<function name="protection" value="lua_building_protection"/>
|
<function name="protection" value="lua_building_protection"/>
|
||||||
<function name="taxes" value="lua_building_taxes"/>
|
<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"/>
|
<requirement type="log" quantity="1"/>
|
||||||
</construction>
|
</construction>
|
||||||
<construction skill="building" minskill="2" maxsize="9" reqsize="1">
|
<construction skill="building" minskill="2" maxsize="5" reqsize="1">
|
||||||
<requirement type="log" quantity="1"/>
|
<requirement type="log" quantity="1"/>
|
||||||
</construction>
|
</construction>
|
||||||
<construction skill="building" minskill="2" maxsize="10" reqsize="1">
|
<construction skill="building" minskill="2" reqsize="1">
|
||||||
<requirement type="log" quantity="1"/>
|
<requirement type="log" quantity="1"/>
|
||||||
</construction>
|
</construction>
|
||||||
</building>
|
</building>
|
||||||
|
|
Loading…
Add table
Reference in a new issue