added meropis buildings

also fixed a bug that prevented tests with ATTACKs to be executed properly (NewbieImmunity)
This commit is contained in:
Enno Rehling 2011-03-09 14:44:31 +01:00
parent fa69da6de2
commit ff51fe6493
2 changed files with 16 additions and 1 deletions

View File

@ -42,6 +42,7 @@ function setup()
write_game("free.dat") write_game("free.dat")
settings.set("nmr.removenewbie", "0") settings.set("nmr.removenewbie", "0")
settings.set("nmr.timeout", "0") settings.set("nmr.timeout", "0")
settings.set("NewbieImmunity", "0")
settings.set("rules.economy.food", "4") settings.set("rules.economy.food", "4")
end end
@ -67,6 +68,7 @@ function test_fleeing_units_can_be_transported()
u1:add_order("ATTACKIEREN " .. itoa36(u2.id)) u1:add_order("ATTACKIEREN " .. itoa36(u2.id))
u2.number = 100 u2.number = 100
u2:add_order("FAHREN " .. itoa36(u3.id)) u2:add_order("FAHREN " .. itoa36(u3.id))
u2:add_order("KAEMPFE FLIEHE")
u3.number = 100 u3.number = 100
u3:add_order("KAEMPFE FLIEHE") u3:add_order("KAEMPFE FLIEHE")
u3:add_order("TRANSPORT " .. itoa36(u2.id)) u3:add_order("TRANSPORT " .. itoa36(u2.id))
@ -1043,7 +1045,7 @@ function test_building_unique()
assert_equal(h1, bs.name) assert_equal(h1, bs.name)
end end
assert_equal(1, string.find(bs.name, "Hafen")) assert_equal(1, string.find(bs.name, "Hafen"))
if bs.size >= 25 then if bs.size >= config.get_building(utype).maxsize then
bcount = bcount + 1 bcount = bcount + 1
end end
end end

View File

@ -126,6 +126,7 @@ typedef struct building_typelist {
quicklist *buildingtypes = NULL; quicklist *buildingtypes = NULL;
/* Returns a building type for the (internal) name */
building_type *bt_find(const char *name) building_type *bt_find(const char *name)
{ {
quicklist *ql; quicklist *ql;
@ -169,6 +170,9 @@ attrib_type at_building_generic_type = {
ATF_UNIQUE ATF_UNIQUE
}; };
/* Returns the (internal) name for a building of given size and type. Especially, returns the correct
* name if it depends on the size (as for Eressea castles).
*/
const char *buildingtype(const building_type * btype, const building * b, const char *buildingtype(const building_type * btype, const building * b,
int bsize) int bsize)
{ {
@ -350,6 +354,8 @@ int wdw_pyramid_level(const struct building *b)
static local_names *bnames; static local_names *bnames;
/* Find the building type for a given localized name (as seen by the user). Useful for parsing
* orders. The inverse of locale_string(lang, btype->_name), sort of. */
const building_type *findbuildingtype(const char *name, const building_type *findbuildingtype(const char *name,
const struct locale *lang) const struct locale *lang)
{ {
@ -391,10 +397,17 @@ static int eressea_building_protection(building * b, unit * u)
return beff; return beff;
} }
static int meropis_building_protection(building * b, unit * u)
{
return 2;
}
void register_buildings(void) void register_buildings(void)
{ {
register_function((pf_generic) & eressea_building_protection, register_function((pf_generic) & eressea_building_protection,
"eressea_building_protection"); "eressea_building_protection");
register_function((pf_generic) & meropis_building_protection,
"meropis_building_protection");
register_function((pf_generic) & init_smithy, "init_smithy"); register_function((pf_generic) & init_smithy, "init_smithy");
register_function((pf_generic) & castle_name, "castle_name"); register_function((pf_generic) & castle_name, "castle_name");
register_function((pf_generic) & castle_name_2, "castle_name_2"); register_function((pf_generic) & castle_name_2, "castle_name_2");