From 455b3dc90e5a2b92f72e1102fd3bc7e97ec69622 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 13 Dec 2014 22:08:57 +0100 Subject: [PATCH 1/4] ignore obsolete "lua" attributes in ancient data files. fix a small bug in the mechanism for reading deprecated attrib_types. --- src/kernel/config.c | 12 ++++++++++++ src/spells.c | 2 +- src/util/attrib.c | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/kernel/config.c b/src/kernel/config.c index 451143f82..0db12308d 100644 --- a/src/kernel/config.c +++ b/src/kernel/config.c @@ -81,6 +81,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #endif /* external libraries */ +#include #include #include @@ -2132,6 +2133,16 @@ bool has_limited_skills(const struct unit * u) } } +static int read_ext(attrib * a, void *owner, struct storage *store) +{ + int len; + + READ_INT(store, &len); + store->api->r_bin(store->handle, NULL, (size_t)len); + return AT_READ_OK; +} + + void attrib_init(void) { /* Alle speicherbaren Attribute müssen hier registriert werden */ @@ -2178,6 +2189,7 @@ void attrib_init(void) at_register(&at_germs); at_deprecate("xontormiaexpress", a_readint); /* required for old datafiles */ + at_deprecate("lua", read_ext); /* required for old datafiles */ } void kernel_init(void) diff --git a/src/spells.c b/src/spells.c index b459b077f..908b6fbec 100644 --- a/src/spells.c +++ b/src/spells.c @@ -4701,7 +4701,7 @@ int sp_gooddreams(castorder * co) } /* ------------------------------------------------------------- */ -/* Name: +/* Name: Seelenkopie / Doppelganger * Stufe: 9 * Kategorie: * Wirkung: diff --git a/src/util/attrib.c b/src/util/attrib.c index 7dc067cc4..d344cdc07 100644 --- a/src/util/attrib.c +++ b/src/util/attrib.c @@ -299,7 +299,7 @@ int a_read(struct storage *store, attrib ** attribs, void *owner) na = a_new(at); } else { - const void * kv; + const void * kv = 0; cb_find_prefix(&cb_deprecated, zText, strlen(zText) + 1, &kv, 1, 0); if (kv) { cb_get_kv(kv, &reader, sizeof(reader)); From 9ac90dd6a5dd5095aa062b0276e3c5518d9a6469 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 13 Dec 2014 23:20:10 +0100 Subject: [PATCH 2/4] bugfix: USE snowman did not check that the unit actually owned a snowman, causing a unit to have negative snowmen in turn 629 (exploit). --- scripts/eressea/xmas2004.lua | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/scripts/eressea/xmas2004.lua b/scripts/eressea/xmas2004.lua index a52c4418e..9b32d7a33 100644 --- a/scripts/eressea/xmas2004.lua +++ b/scripts/eressea/xmas2004.lua @@ -1,12 +1,18 @@ function use_snowman(u, amount) - if u.region.terrain == "glacier" then - local man = unit.create(u.faction, u.region) - man.race = "snowman" - man.number = amount - u:add_item("snowman", -amount) - return 0 - end - return -4 + local have = u:get_item("snowman") + if have0 and u.region.terrain == "glacier" then + local man = unit.create(u.faction, u.region) + man.race = "snowman" + man.number = amount + if u:add_item("snowman", -amount)~= nil then + return -1 + end + return 0 + end + return -4 end local self = {} From dd87907566fb5f466294e2d3b33e0b040c00b3dc Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 13 Dec 2014 23:37:42 +0100 Subject: [PATCH 3/4] bugfix: making clones help with upkeep. https://bugs.eressea.de/view.php?id=1560 --- res/e3a/races.xml | 2 +- res/eressea/races.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/res/e3a/races.xml b/res/e3a/races.xml index 0e5166d42..d5139298b 100644 --- a/res/e3a/races.xml +++ b/res/e3a/races.xml @@ -747,7 +747,7 @@ - + diff --git a/res/eressea/races.xml b/res/eressea/races.xml index d34d2bb28..530b7298f 100644 --- a/res/eressea/races.xml +++ b/res/eressea/races.xml @@ -981,7 +981,7 @@ - + From dca9d7e9cbf2e571a293a8cd43249c042a5a000a Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 14 Dec 2014 06:02:08 +0100 Subject: [PATCH 4/4] bugfixe give_cmd (cannot give more persons than the unit has). --- src/give.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/give.c b/src/give.c index 7a17b2da3..f64bf0a51 100644 --- a/src/give.c +++ b/src/give.c @@ -750,6 +750,7 @@ void give_cmd(unit * u, order * ord) msg_feedback(u, ord, "race_noregroup", "race", u_race(u))); return; } + n = _min(u->number, n); msg = u2 ? give_men(n, u, u2, ord) : disband_men(n, u, ord); if (msg) { ADDMSG(&u->faction->msgs, msg);