diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..9cebe6d6d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,26 @@ +# EditorConfig is awesome: http://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true + +# 4 space indentation +[*.{c,h,lua}] +indent_style = space +indent_size = 4 + +[*.{xml,json}] +charset = utf-8 + +# Tab indentation (no size specified) +[Makefile] +indent_style = tab + +# Matches exact files +[.travis.yml] +indent_style = space +indent_size = 2 diff --git a/res/adamantium.xml b/res/adamantium.xml index d5cdd4fae..cc1cedadc 100644 --- a/res/adamantium.xml +++ b/res/adamantium.xml @@ -3,7 +3,7 @@ - + @@ -13,7 +13,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/res/buildings/castle-2.xml b/res/buildings/castle-2.xml index a54957415..593e9ae5e 100644 --- a/res/buildings/castle-2.xml +++ b/res/buildings/castle-2.xml @@ -3,22 +3,22 @@ - + - + - + - + - + - + diff --git a/res/buildings/castle.xml b/res/buildings/castle.xml index 9a63d7dc8..253f49811 100644 --- a/res/buildings/castle.xml +++ b/res/buildings/castle.xml @@ -2,25 +2,25 @@ - + - + - + - + - + - + - + diff --git a/res/core/armor/chainmail.xml b/res/core/armor/chainmail.xml index 81152f89e..b03221b35 100644 --- a/res/core/armor/chainmail.xml +++ b/res/core/armor/chainmail.xml @@ -1,7 +1,7 @@ - + diff --git a/res/core/armor/laenmail.xml b/res/core/armor/laenmail.xml index bdcf6b7e1..0e1411945 100644 --- a/res/core/armor/laenmail.xml +++ b/res/core/armor/laenmail.xml @@ -1,7 +1,7 @@ - + diff --git a/res/core/armor/laenshield.xml b/res/core/armor/laenshield.xml index f5eb2d783..8a9d6d5c3 100644 --- a/res/core/armor/laenshield.xml +++ b/res/core/armor/laenshield.xml @@ -1,7 +1,7 @@ - + diff --git a/res/core/armor/plate.xml b/res/core/armor/plate.xml index eb10f6359..a22064e90 100644 --- a/res/core/armor/plate.xml +++ b/res/core/armor/plate.xml @@ -2,7 +2,7 @@ - + diff --git a/res/core/armor/rustychainmail.xml b/res/core/armor/rustychainmail.xml index a52b4db7b..b46380634 100644 --- a/res/core/armor/rustychainmail.xml +++ b/res/core/armor/rustychainmail.xml @@ -1,7 +1,7 @@ - + diff --git a/res/core/armor/rustyshield.xml b/res/core/armor/rustyshield.xml index 4c34f7ee1..56a8abe5a 100644 --- a/res/core/armor/rustyshield.xml +++ b/res/core/armor/rustyshield.xml @@ -1,7 +1,7 @@ - + diff --git a/res/core/armor/shield.xml b/res/core/armor/shield.xml index 9a72baf9a..b0ee7de3a 100644 --- a/res/core/armor/shield.xml +++ b/res/core/armor/shield.xml @@ -1,7 +1,7 @@ - + diff --git a/res/core/common/buildings.xml b/res/core/common/buildings.xml index 63ac3e650..423e90deb 100644 --- a/res/core/common/buildings.xml +++ b/res/core/common/buildings.xml @@ -66,7 +66,7 @@ - + @@ -76,7 +76,7 @@ - + @@ -86,7 +86,7 @@ - + @@ -98,7 +98,7 @@ - + @@ -139,7 +139,7 @@ - + @@ -149,7 +149,7 @@ - + @@ -159,7 +159,7 @@ - + diff --git a/res/core/common/construction.xml b/res/core/common/construction.xml index 95dcb6a33..089ddfe1c 100644 --- a/res/core/common/construction.xml +++ b/res/core/common/construction.xml @@ -1,10 +1,10 @@ - + - + diff --git a/res/core/common/items.xml b/res/core/common/items.xml index c8910e695..6afd220ff 100644 --- a/res/core/common/items.xml +++ b/res/core/common/items.xml @@ -143,7 +143,7 @@ - + diff --git a/res/core/common/potions.xml b/res/core/common/potions.xml index f444e5a94..84b1e5f52 100644 --- a/res/core/common/potions.xml +++ b/res/core/common/potions.xml @@ -7,7 +7,7 @@ - + @@ -18,7 +18,7 @@ - + @@ -29,7 +29,7 @@ - + @@ -40,7 +40,7 @@ - + @@ -51,7 +51,7 @@ - + @@ -64,7 +64,7 @@ - + @@ -77,7 +77,7 @@ - + @@ -90,7 +90,7 @@ - + @@ -103,7 +103,7 @@ - + @@ -116,7 +116,7 @@ - + @@ -129,7 +129,7 @@ - + @@ -142,7 +142,7 @@ - + @@ -155,7 +155,7 @@ - + @@ -169,7 +169,7 @@ - + @@ -184,7 +184,7 @@ - + diff --git a/res/core/resources/cart.xml b/res/core/resources/cart.xml index af3860c9c..17dbdcb41 100644 --- a/res/core/resources/cart.xml +++ b/res/core/resources/cart.xml @@ -1,7 +1,7 @@ - + diff --git a/res/core/resources/horse.xml b/res/core/resources/horse.xml index abf6d856d..53699c696 100644 --- a/res/core/resources/horse.xml +++ b/res/core/resources/horse.xml @@ -1,7 +1,7 @@ - + diff --git a/res/core/resources/iron.xml b/res/core/resources/iron.xml index 94dbc6390..7bc4cb428 100644 --- a/res/core/resources/iron.xml +++ b/res/core/resources/iron.xml @@ -1,7 +1,7 @@ - + diff --git a/res/core/resources/laen.xml b/res/core/resources/laen.xml index efb13c5ed..571026a0a 100644 --- a/res/core/resources/laen.xml +++ b/res/core/resources/laen.xml @@ -1,7 +1,7 @@ - + diff --git a/res/core/resources/log.xml b/res/core/resources/log.xml index c017682fc..012fe9a20 100644 --- a/res/core/resources/log.xml +++ b/res/core/resources/log.xml @@ -1,7 +1,7 @@ - + diff --git a/res/core/resources/mallorn.xml b/res/core/resources/mallorn.xml index e5c01506b..2d301758e 100644 --- a/res/core/resources/mallorn.xml +++ b/res/core/resources/mallorn.xml @@ -1,7 +1,7 @@ - + diff --git a/res/core/resources/mallornseed.xml b/res/core/resources/mallornseed.xml index 1c7c1a800..7a5a0310f 100644 --- a/res/core/resources/mallornseed.xml +++ b/res/core/resources/mallornseed.xml @@ -1,6 +1,6 @@ - + diff --git a/res/core/resources/seed.xml b/res/core/resources/seed.xml index 2193fb8c8..99f5f5804 100644 --- a/res/core/resources/seed.xml +++ b/res/core/resources/seed.xml @@ -1,6 +1,6 @@ - + diff --git a/res/core/resources/stone.xml b/res/core/resources/stone.xml index eed2fd2df..c227dcc5c 100644 --- a/res/core/resources/stone.xml +++ b/res/core/resources/stone.xml @@ -1,7 +1,7 @@ - + diff --git a/res/core/ships.xml b/res/core/ships.xml index 0ce254328..fc87bc3d3 100644 --- a/res/core/ships.xml +++ b/res/core/ships.xml @@ -2,28 +2,28 @@ - + - + - + - + @@ -39,7 +39,7 @@ - + @@ -53,7 +53,7 @@ - + @@ -69,7 +69,7 @@ - + diff --git a/res/core/weapons/axe.xml b/res/core/weapons/axe.xml index 7ee77b21e..80a872ad7 100644 --- a/res/core/weapons/axe.xml +++ b/res/core/weapons/axe.xml @@ -2,7 +2,7 @@ - + diff --git a/res/core/weapons/bow.xml b/res/core/weapons/bow.xml index c64392966..4fb9b2000 100644 --- a/res/core/weapons/bow.xml +++ b/res/core/weapons/bow.xml @@ -1,7 +1,7 @@ - + diff --git a/res/core/weapons/catapult.xml b/res/core/weapons/catapult.xml index 08dc83457..e05c5a025 100644 --- a/res/core/weapons/catapult.xml +++ b/res/core/weapons/catapult.xml @@ -1,7 +1,7 @@ - + diff --git a/res/core/weapons/crossbow.xml b/res/core/weapons/crossbow.xml index 318628b81..c7bf4715d 100644 --- a/res/core/weapons/crossbow.xml +++ b/res/core/weapons/crossbow.xml @@ -1,7 +1,7 @@ - + diff --git a/res/core/weapons/greatbow.xml b/res/core/weapons/greatbow.xml index 542bd41a8..10b270e55 100644 --- a/res/core/weapons/greatbow.xml +++ b/res/core/weapons/greatbow.xml @@ -2,7 +2,7 @@ - + diff --git a/res/core/weapons/greatsword.xml b/res/core/weapons/greatsword.xml index 481ff680c..cd48b8296 100644 --- a/res/core/weapons/greatsword.xml +++ b/res/core/weapons/greatsword.xml @@ -2,7 +2,7 @@ - + diff --git a/res/core/weapons/halberd.xml b/res/core/weapons/halberd.xml index bf3fb4af7..5025f4793 100644 --- a/res/core/weapons/halberd.xml +++ b/res/core/weapons/halberd.xml @@ -2,7 +2,7 @@ - + diff --git a/res/core/weapons/laensword.xml b/res/core/weapons/laensword.xml index 31ec8b9e6..3053d5f1b 100644 --- a/res/core/weapons/laensword.xml +++ b/res/core/weapons/laensword.xml @@ -1,7 +1,7 @@ - + diff --git a/res/core/weapons/lance.xml b/res/core/weapons/lance.xml index 1271c48f9..abbb7f31f 100644 --- a/res/core/weapons/lance.xml +++ b/res/core/weapons/lance.xml @@ -2,7 +2,7 @@ - + diff --git a/res/core/weapons/mallornbow.xml b/res/core/weapons/mallornbow.xml index f61ea8e97..abdcc4810 100644 --- a/res/core/weapons/mallornbow.xml +++ b/res/core/weapons/mallornbow.xml @@ -1,7 +1,7 @@ - + diff --git a/res/core/weapons/mallorncrossbow.xml b/res/core/weapons/mallorncrossbow.xml index fb7be26c0..385720d8c 100644 --- a/res/core/weapons/mallorncrossbow.xml +++ b/res/core/weapons/mallorncrossbow.xml @@ -1,7 +1,7 @@ - + diff --git a/res/core/weapons/mallornlance.xml b/res/core/weapons/mallornlance.xml index 88973f3e0..0186143e4 100644 --- a/res/core/weapons/mallornlance.xml +++ b/res/core/weapons/mallornlance.xml @@ -2,7 +2,7 @@ - + diff --git a/res/core/weapons/mallornspear.xml b/res/core/weapons/mallornspear.xml index 8c3782e4c..66d41a943 100644 --- a/res/core/weapons/mallornspear.xml +++ b/res/core/weapons/mallornspear.xml @@ -1,7 +1,7 @@ - + diff --git a/res/core/weapons/rep_crossbow.xml b/res/core/weapons/rep_crossbow.xml index 1e550a190..66e3f9fc2 100644 --- a/res/core/weapons/rep_crossbow.xml +++ b/res/core/weapons/rep_crossbow.xml @@ -2,7 +2,7 @@ - + diff --git a/res/core/weapons/rustyaxe.xml b/res/core/weapons/rustyaxe.xml index 5399de62d..2ff19570c 100644 --- a/res/core/weapons/rustyaxe.xml +++ b/res/core/weapons/rustyaxe.xml @@ -2,7 +2,7 @@ - + diff --git a/res/core/weapons/rustygreatsword.xml b/res/core/weapons/rustygreatsword.xml index ac1385b11..7f21cce17 100644 --- a/res/core/weapons/rustygreatsword.xml +++ b/res/core/weapons/rustygreatsword.xml @@ -1,7 +1,7 @@ - + diff --git a/res/core/weapons/rustyhalberd.xml b/res/core/weapons/rustyhalberd.xml index 4f237b989..c1b1f69a9 100644 --- a/res/core/weapons/rustyhalberd.xml +++ b/res/core/weapons/rustyhalberd.xml @@ -2,7 +2,7 @@ - + diff --git a/res/core/weapons/rustysword.xml b/res/core/weapons/rustysword.xml index f73dcd6e2..2a76c109b 100644 --- a/res/core/weapons/rustysword.xml +++ b/res/core/weapons/rustysword.xml @@ -1,7 +1,7 @@ - + diff --git a/res/core/weapons/spear.xml b/res/core/weapons/spear.xml index c6479707a..32a79b9a2 100644 --- a/res/core/weapons/spear.xml +++ b/res/core/weapons/spear.xml @@ -1,7 +1,7 @@ - + diff --git a/res/core/weapons/sword.xml b/res/core/weapons/sword.xml index 0d3830e2e..4bd2ebdb1 100644 --- a/res/core/weapons/sword.xml +++ b/res/core/weapons/sword.xml @@ -1,7 +1,7 @@ - + diff --git a/res/e3a/armor/chainmail.xml b/res/e3a/armor/chainmail.xml index 39743d754..509df07e6 100644 --- a/res/e3a/armor/chainmail.xml +++ b/res/e3a/armor/chainmail.xml @@ -1,7 +1,7 @@ - + diff --git a/res/e3a/armor/laenmail.xml b/res/e3a/armor/laenmail.xml index d3b1dd533..f03add574 100644 --- a/res/e3a/armor/laenmail.xml +++ b/res/e3a/armor/laenmail.xml @@ -1,7 +1,7 @@ - + diff --git a/res/e3a/armor/laenshield.xml b/res/e3a/armor/laenshield.xml index 1ce6216b2..8d003bccc 100644 --- a/res/e3a/armor/laenshield.xml +++ b/res/e3a/armor/laenshield.xml @@ -1,7 +1,7 @@ - + diff --git a/res/e3a/armor/plate.xml b/res/e3a/armor/plate.xml index 550e83173..29cabbf1a 100644 --- a/res/e3a/armor/plate.xml +++ b/res/e3a/armor/plate.xml @@ -2,7 +2,7 @@ - + diff --git a/res/e3a/armor/rustychainmail.xml b/res/e3a/armor/rustychainmail.xml index ac2628c62..361564c76 100644 --- a/res/e3a/armor/rustychainmail.xml +++ b/res/e3a/armor/rustychainmail.xml @@ -1,7 +1,7 @@ - + diff --git a/res/e3a/armor/rustyshield.xml b/res/e3a/armor/rustyshield.xml index 2becae180..d9d8a54ef 100644 --- a/res/e3a/armor/rustyshield.xml +++ b/res/e3a/armor/rustyshield.xml @@ -1,7 +1,7 @@ - + diff --git a/res/e3a/armor/scale.xml b/res/e3a/armor/scale.xml index 809d08bca..7039b4008 100644 --- a/res/e3a/armor/scale.xml +++ b/res/e3a/armor/scale.xml @@ -2,7 +2,7 @@ - + diff --git a/res/e3a/armor/shield.xml b/res/e3a/armor/shield.xml index 9b4ad9174..5770711e2 100644 --- a/res/e3a/armor/shield.xml +++ b/res/e3a/armor/shield.xml @@ -1,7 +1,7 @@ - + diff --git a/res/e3a/armor/towershield.xml b/res/e3a/armor/towershield.xml index 5a7edcabe..e80c03523 100644 --- a/res/e3a/armor/towershield.xml +++ b/res/e3a/armor/towershield.xml @@ -2,7 +2,7 @@ - + diff --git a/res/e3a/buildings.xml b/res/e3a/buildings.xml index 231596dc6..8ca30d27d 100644 --- a/res/e3a/buildings.xml +++ b/res/e3a/buildings.xml @@ -3,24 +3,24 @@ - + - + + + + + + + - - - - - - - + diff --git a/res/e3a/items.xml b/res/e3a/items.xml index 706bd0d67..7d7e6b286 100644 --- a/res/e3a/items.xml +++ b/res/e3a/items.xml @@ -71,7 +71,7 @@ - + diff --git a/res/e3a/resources/iron.xml b/res/e3a/resources/iron.xml index 3856c045d..b245da358 100644 --- a/res/e3a/resources/iron.xml +++ b/res/e3a/resources/iron.xml @@ -1,7 +1,7 @@ - + diff --git a/res/e3a/resources/stone.xml b/res/e3a/resources/stone.xml index 854003c86..746b79c21 100644 --- a/res/e3a/resources/stone.xml +++ b/res/e3a/resources/stone.xml @@ -1,7 +1,7 @@ - + diff --git a/res/e3a/ships.xml b/res/e3a/ships.xml index b8c5f0197..291900a3b 100644 --- a/res/e3a/ships.xml +++ b/res/e3a/ships.xml @@ -10,7 +10,7 @@ - + @@ -20,7 +20,7 @@ - + @@ -35,7 +35,7 @@ - + @@ -50,7 +50,7 @@ - + @@ -66,7 +66,7 @@ - + @@ -75,7 +75,7 @@ - + @@ -85,7 +85,7 @@ - + @@ -93,7 +93,7 @@ - + @@ -103,7 +103,7 @@ - + @@ -113,7 +113,7 @@ - + @@ -125,7 +125,7 @@ - + @@ -136,7 +136,7 @@ - + diff --git a/res/e3a/weapons/crossbow.xml b/res/e3a/weapons/crossbow.xml index 57535a070..7b2ed743c 100644 --- a/res/e3a/weapons/crossbow.xml +++ b/res/e3a/weapons/crossbow.xml @@ -1,7 +1,7 @@ - + diff --git a/res/e3a/weapons/greatbow.xml b/res/e3a/weapons/greatbow.xml index ba91f54de..7f08427c8 100644 --- a/res/e3a/weapons/greatbow.xml +++ b/res/e3a/weapons/greatbow.xml @@ -6,7 +6,7 @@ - + diff --git a/res/e3a/weapons/greatsword.xml b/res/e3a/weapons/greatsword.xml index 5fc1c9042..5a199321d 100644 --- a/res/e3a/weapons/greatsword.xml +++ b/res/e3a/weapons/greatsword.xml @@ -4,7 +4,7 @@ --> - + diff --git a/res/e3a/weapons/halberd.xml b/res/e3a/weapons/halberd.xml index edb933701..2c11b62fc 100644 --- a/res/e3a/weapons/halberd.xml +++ b/res/e3a/weapons/halberd.xml @@ -5,7 +5,7 @@ - + diff --git a/res/e3a/weapons/laensword.xml b/res/e3a/weapons/laensword.xml index 13ebbf03e..50f824e8c 100644 --- a/res/e3a/weapons/laensword.xml +++ b/res/e3a/weapons/laensword.xml @@ -4,7 +4,7 @@ --> - + diff --git a/res/e3a/weapons/mallorncrossbow.xml b/res/e3a/weapons/mallorncrossbow.xml index 920ae553f..86991bc10 100644 --- a/res/e3a/weapons/mallorncrossbow.xml +++ b/res/e3a/weapons/mallorncrossbow.xml @@ -1,7 +1,7 @@ - + diff --git a/res/e3a/weapons/mallornlance.xml b/res/e3a/weapons/mallornlance.xml index 6355f5780..1fcad08c8 100644 --- a/res/e3a/weapons/mallornlance.xml +++ b/res/e3a/weapons/mallornlance.xml @@ -2,7 +2,7 @@ - + diff --git a/res/e3a/weapons/rustygreatsword.xml b/res/e3a/weapons/rustygreatsword.xml index 818fac553..607f16a6a 100644 --- a/res/e3a/weapons/rustygreatsword.xml +++ b/res/e3a/weapons/rustygreatsword.xml @@ -4,7 +4,7 @@ --> - + diff --git a/res/e3a/weapons/rustyhalberd.xml b/res/e3a/weapons/rustyhalberd.xml index bab849b49..ed25d5db7 100644 --- a/res/e3a/weapons/rustyhalberd.xml +++ b/res/e3a/weapons/rustyhalberd.xml @@ -5,7 +5,7 @@ - + diff --git a/res/ships/boat.xml b/res/ships/boat.xml index 91852de92..551fea702 100644 --- a/res/ships/boat.xml +++ b/res/ships/boat.xml @@ -10,7 +10,7 @@ - + diff --git a/src/creport.c b/src/creport.c index ab5813e8a..6ba9f5e39 100644 --- a/src/creport.c +++ b/src/creport.c @@ -1160,7 +1160,8 @@ int seemode, FILE * F) } } if (cs) { - const char *bname = mkname("border", b->type->name(b, r, f, GF_PURE)); + const char *bname = border_name(b, r, f, GF_PURE); + bname = mkname("border", bname); fprintf(F, "GRENZE %d\n", ++g); fprintf(F, "\"%s\";typ\n", LOC(default_locale, bname)); fprintf(F, "%d;richtung\n", d); diff --git a/src/kernel/build.c b/src/kernel/build.c index f3c74bf95..97e5e84d0 100644 --- a/src/kernel/build.c +++ b/src/kernel/build.c @@ -849,7 +849,6 @@ build_building(unit * u, const building_type * btype, int id, int want, order * b->size += built; if (b->type->maxsize > 0 && b->size > b->type->maxsize) { - // this seems to be okay for a watch, but is not okay for an academy or harbour log_error("build: %s has size=%d, maxsize=%d", buildingname(b), b->size, b->type->maxsize); } fset(b, BLD_EXPANDED); diff --git a/src/kernel/building.c b/src/kernel/building.c index f0e46cc7e..e7c60ea9a 100644 --- a/src/kernel/building.c +++ b/src/kernel/building.c @@ -132,7 +132,7 @@ int buildingcapacity(const building * b) } return b->size * b->type->capacity; } - if (b->size >= b->type->maxsize) { + if (building_finished(b)) { if (b->type->maxcapacity >= 0) { return b->type->maxcapacity; } @@ -648,15 +648,20 @@ buildingtype_exists(const region * r, const building_type * bt, bool working) building *b; for (b = rbuildings(r); b; b = b->next) { - if (b->type == bt && b->size >= bt->maxsize && (!working || fval(b, BLD_WORKING))) + if (b->type == bt && (!working || fval(b, BLD_WORKING)) && building_finished(b)) { return true; + } } return false; } +bool building_finished(const struct building *b) { + return b->size >= b->type->maxsize; +} + bool building_is_active(const struct building *b) { - return b && fval(b, BLD_WORKING) && b->size >= b->type->maxsize; + return b && fval(b, BLD_WORKING) && building_finished(b); } building *active_building(const unit *u, const struct building_type *btype) { diff --git a/src/kernel/building.h b/src/kernel/building.h index 766242c4a..52b715c59 100644 --- a/src/kernel/building.h +++ b/src/kernel/building.h @@ -92,15 +92,7 @@ extern "C" { const struct building *b, int bsize); bool in_safe_building(struct unit *u1, struct unit *u2); - /* buildingt => building_type - * Name => locale_string(name) - * MaxGroesse => levels - * MinBauTalent => construction->minskill - * Kapazitaet => capacity, maxcapacity - * Materialien => construction->materials - * UnterSilber, UnterSpezialTyp, UnterSpezial => maintenance - * per_size => !maintenance->fixed - */ + #define BFL_NONE 0x00 #define BLD_MAINTAINED 0x01 /* vital maintenance paid for */ #define BLD_WORKING 0x02 /* full maintenance paid, it works */ @@ -138,6 +130,7 @@ extern "C" { struct region *r, const struct locale *lang); int build_building(struct unit *u, const struct building_type *typ, int id, int size, struct order *ord); + bool building_finished(const struct building *b); /* Alte Gebäudetypen: */ @@ -173,10 +166,6 @@ extern "C" { bool building_is_active(const struct building *b); struct building *active_building(const struct unit *u, const struct building_type *btype); -#ifdef WDW_PYRAMID - extern int wdw_pyramid_level(const struct building *b); -#endif - extern const char *buildingname(const struct building *b); extern const char *building_getname(const struct building *b); diff --git a/src/kernel/connection.c b/src/kernel/connection.c index d9f1871d0..f1e5c4b6d 100644 --- a/src/kernel/connection.c +++ b/src/kernel/connection.c @@ -677,3 +677,7 @@ int read_borders(gamedata *data) } return 0; } + +const char * border_name(const connection *co, const struct region * r, const struct faction * f, int flags) { + return (co->type->name) ? co->type->name(co, r, f, flags) : co->type->__name; +} diff --git a/src/kernel/connection.h b/src/kernel/connection.h index 2c0800849..7eef0f52a 100644 --- a/src/kernel/connection.h +++ b/src/kernel/connection.h @@ -148,6 +148,9 @@ extern "C" { /* game-specific callbacks */ void(*border_convert_cb) (struct connection * con, struct attrib * attr); + const char * border_name(const struct connection *co, + const struct region * r, const struct faction * f, int flags); + #ifdef __cplusplus } #endif diff --git a/src/kernel/save.c b/src/kernel/save.c index fd82bed96..2379db877 100644 --- a/src/kernel/save.c +++ b/src/kernel/save.c @@ -1676,6 +1676,7 @@ int read_game(gamedata *data) { if (b->type == bt_lighthouse) { r->flags |= RF_LIGHTHOUSE; } + // repairs, bug 2221: if (b->type->maxsize>0 && b->size>b->type->maxsize) { log_error("building too big: %s (%s size %d of %d), fixing.", buildingname(b), b->type->_name, b->size, b->type->maxsize); diff --git a/src/kernel/unit.c b/src/kernel/unit.c index e41e5b006..09b3d80a9 100644 --- a/src/kernel/unit.c +++ b/src/kernel/unit.c @@ -1044,7 +1044,7 @@ struct building *inside_building(const struct unit *u) if (!u->building) { return NULL; } - else if (u->building->size < u->building->type->maxsize) { + else if (!building_finished(u->building)) { /* Gebaeude noch nicht fertig */ return NULL; } diff --git a/src/kernel/version.h b/src/kernel/version.h index 7ef7d9c36..4aab16f5f 100644 --- a/src/kernel/version.h +++ b/src/kernel/version.h @@ -10,7 +10,7 @@ without prior permission by the authors of Eressea. */ -#define INTPAK_VERSION 329 /* in binary, ints can get packed */ +#define INTPAK_VERSION 329 /* in binary, ints can get packed. starting with E2/572 */ #define NOZEROIDS_VERSION 330 /* 2008-05-16 zero is not a valid ID for anything (including factions) */ #define NOBORDERATTRIBS_VERSION 331 /* 2008-05-17 connection::attribs has been moved to userdata */ #define UIDHASH_VERSION 332 /* 2008-05-22 borders use the region.uid to store */ diff --git a/src/kernel/xmlreader.c b/src/kernel/xmlreader.c index f4e5fd751..da8014d67 100644 --- a/src/kernel/xmlreader.c +++ b/src/kernel/xmlreader.c @@ -169,7 +169,7 @@ construction ** consPtr) con->skill = sk; con->maxsize = xml_ivalue(node, "maxsize", -1); con->minskill = xml_ivalue(node, "minskill", -1); - con->reqsize = xml_ivalue(node, "reqsize", -1); + con->reqsize = xml_ivalue(node, "reqsize", 1); con->defense_bonus = xml_ivalue(node, "defense_bonus", 0); con->close_combat_bonus = xml_ivalue(node, "close_combat_bonus", 0); con->ranged_bonus = xml_ivalue(node, "ranged_bonus", 0); diff --git a/src/move.c b/src/move.c index e7ca523b5..6c5950c1f 100644 --- a/src/move.c +++ b/src/move.c @@ -1758,7 +1758,7 @@ unit *owner_buildingtyp(const region * r, const building_type * bt) for (b = rbuildings(r); b; b = b->next) { owner = building_owner(b); if (b->type == bt && owner != NULL) { - if (b->size >= bt->maxsize) { + if (building_finished(b)) { return owner; } } diff --git a/src/report.c b/src/report.c index 15c5f1b2c..84b1291b2 100644 --- a/src/report.c +++ b/src/report.c @@ -915,7 +915,7 @@ static void describe(stream *out, const seen_region * sr, faction * f) for (b = get_borders(r, r2); b;) { struct edge *e = edges; bool transparent = b->type->transparent(b, f); - const char *name = b->type->name(b, r, f, GF_DETAILED | GF_ARTICLE); + const char *name = border_name(b, r, f, GF_DETAILED | GF_ARTICLE); if (!transparent) see[d] = false; @@ -1898,7 +1898,7 @@ const faction * f) } } - if (b->size < b->type->maxsize) { + if (!building_finished(b)) { bytes = (int)strlcpy(bufp, LOC(lang, "nr_building_inprogress"), size); if (wrptr(&bufp, &size, bytes) != 0) WARN_STATIC_BUFFER(); diff --git a/src/spells.c b/src/spells.c index b93c373ae..1da440df2 100644 --- a/src/spells.c +++ b/src/spells.c @@ -975,7 +975,7 @@ static int sp_blessstonecircle(castorder * co) return 0; } - if (b->size < b->type->maxsize) { + if (!building_finished(b)) { ADDMSG(&mage->faction->msgs, msg_feedback(mage, co->order, "error_notcomplete", "building", b)); return 0; @@ -4502,11 +4502,11 @@ int sp_icastle(castorder * co) if (type == bt_illusion) { b->size = (rng_int() % (int)((power * power) + 1) * 10); } - else if (type->maxsize == -1) { - b->size = ((rng_int() % (int)(power)) + 1) * 5; + else if (type->maxsize >0) { + b->size = type->maxsize; } else { - b->size = type->maxsize; + b->size = ((rng_int() % (int)(power)) + 1) * 5; } if (type->name == NULL) { diff --git a/src/wormhole.c b/src/wormhole.c index 36e04e9e0..916c0509d 100644 --- a/src/wormhole.c +++ b/src/wormhole.c @@ -149,8 +149,7 @@ make_wormhole(const building_type * bt_wormhole, region * r1, region * r2) attrib *a2 = a_add(&b2->attribs, a_new(&at_wormhole)); a1->data.v = b2->region; a2->data.v = b1->region; - b1->size = bt_wormhole->maxsize; - b2->size = bt_wormhole->maxsize; + b1->size = b2->size = bt_wormhole->maxcapacity * bt_wormhole->capacity; ADDMSG(&r1->msgs, msg_message("wormhole_appear", "region", r1)); ADDMSG(&r2->msgs, msg_message("wormhole_appear", "region", r2)); }